--config claudia-prod.json
option to do that).
I have a lambda that uses a layer (sharp) that requires specific Linux binaries for lambda.
What's the best way to deploy this using claudiajs?
I'm using TypeScript and during local development I have the sharp library as a devDependency.
When it's running in AWS, it'll resolve
import sharp from 'sharp'
from the layer and when locally, from the devDependency.
But if I try to deploy it fails because it cannot find sharp.
In the docs it talks about using --use-local-dependencies for a similar use case where binaries are needed for a different platform but I can't see how that works with layers where that dependency will never be directly within the lambda's own node_modules
I have a process triggered by an HTTP request to API Gateway that can last longer than 30s. It's retrieving a bunch of data, doing some conversions zipping up and returning.
To work around the 30s limit of API Gateway I'm creating a presigned URL for the file which I want to return immediately in the API response.
Then go ahead and actually build the contents of that file.
So I do something like this
api.get(
'/searchcsv',
async (request: ApiRequest) => {
const filename = `some-file-name-${new Date().valueOf()}.zip`;
const url = await getSignedUrlforCsv(filename);
searchInventory(request, filename);
return {
url,
};
},
What seems to happen is that the lambda execution is terminated as soon as the return occurs. Is this something to do with the way claudia-api-builder works or is this fundamental to API Gateway? It seems unlikely it's the latter as that would mean tightly coupling API GW and Lambda but I could be wrong.
You can’t continue Lambda execution after returning a result to the API Gateway, that’s not Claudia API Builder limitation, it’s the AWS feature. However, you can send a background message using the SNS notification (or SQS, EventBridge, etc.) and continue running in the background.
If you are generating the file, it would be similar to the following:
sharp
, this is the problem that Claudia doesn't solve really well, because it's not easy to solve it for all cases. Your solution works fine. In the Lambda function itself, sharp
will be available like any other globally available module, so you can install sharp
globally and then you should be able to pack your node modules without sharp
using Claudia, and everything will still work after you deploy it.
You can’t continue Lambda execution after returning a result to the API Gateway, that’s not Claudia API Builder limitation, it’s the AWS feature. However, you can send a background message using the SNS notification (or SQS, EventBridge, etc.) and continue running in the background.
If you are generating the file, it would be similar to the following:
- HTTP request sends the SNS message, and then returns a presigned URL
- Frontend pings that S3 URL each second to see if it’s ready
- The SNS message triggers another Lambda function that does the logic in the background and saves the result to the S3 file.
Thanks @stojanovic - that's almost exactly the pattern I went with, except using SQS instead of SNS
Hello guys, when run:
claudia update --use-local-dependencies
Happens:npm ERR! code EEXIST
npm ERR! path /private/var/folders/gp/tksqwx0x3w96hnd2p_zczk480000gp/T/tKqD1w/quryappgwaws-1.0.0-HAkaXS/package/node_modules/claudia/node_modules/aws-sdk/node_modules/.bin/uuid
I am following this guide:
Building a Serverless Application in AWS using React and Claudiajs
Hi, I want to use
nodegit
in my lambda function, this requires access to the local file system. Does lambda even has a "local file system" or if it doesn't and I need to attach some other AWS resource (s3?) to mimic the fs, can claudia help with that?
You can access the /tmp folder but you can't rely on anything you write there being available on other runs. There's now EFS support in lambda too but I'm not familiar with it yet.
Hi everyone, so I'm facing some problems with claudia bot builder, Does any one know how to fix, what I'm doing wrong ?
'OAuth "Facebook Platform" "invalid_request" "(#100) The parameter subscribed_fields is required.-
Here is my configuration
`
"scripts": {
"create": "claudia create --api-module bot --region eu-west-1 --configure-fb-bot",
"configure-fb": "claudia update --configure-fb-bot",
"deploy": "claudia update"
},
"dependencies": {
"claudia": "^5.12.0",
"claudia-bot-builder": "^4.5.0"
}
`
Hi, when using the add-scheduled-event, I want to be able to run it to change an existing schedule.
Currently if I run add-scheduled-event twice with two different --cron defintions, it creates two identical targets in the EventBridge, under one rule...
Am I doing something wrong?