canpan14
canpan14

Reputation: 1273

No response from invoke container when running sam local invoke

Trying to test a basic lambda locally that runs fine in AWS but I keep getting

No response from invoke container for MyLambdaXXXXXXXX

'tsc' and 'synth' run fine and I get a proper cdk.out

The invoke command is

sam local invoke --region us-east-1 --env-vars .env.json -t ./cdk.out/my-project.template.json -e events/example.event.json MyLambdaXXXXXXXX

There is no api or anything docker related that I find in similar questions like the few listed below.

The only output I see is this (no logs from even the first line of the lambda)

Invoking index.execute (nodejs14.x)
Skip pulling image and use local one: public.ecr.aws/sam/emulation-nodejs14.x:rapid-1.46.0-x86_64.

Mounting /path-to-my-project/my-project/cdk.out/asset.aaaaa9999999cd5a9f38e9c4e503cc9c9bdf8ccdc8f9999991b12b6161e99999 as /var/task:ro,delegated inside runtime container
No response from invoke container for MyLambdaXXXXXXXX

Process finished with exit code 0

If it matters my handler structure for my lambda is async

export const execute = async (sqsEvent: SQSEvent): Promise<PutEventsCommandOutput> => {
  await someAsyncStuffWithDocumentDB()
}

And I'm using NodejsFunction cdk with bundling like this

bundling: {
  minify: true,
  sourceMap: true,
  externalModules: ['aws-lambda', 'aws-sdk'],
  loader: { '.pem': 'file' }, // cert for DocumentDB
},

Upvotes: 2

Views: 2454

Answers (1)

Zander Hsu
Zander Hsu

Reputation: 49

I came across similar issue and solved it by increasing 'Timeout' from 3 to 10 in [template.yaml] file. When you import(or require) a number of npm packages, the loading time can be pretty long, maybe 3 secs are not enough. Just my guess

Upvotes: 2

Related Questions