I have a node.js lambda function that adds a database entry and then calls another lambda function. The code works fine when I test locally via
serverless invoke local --function create --path mocks/create-event.json
but it fails when I invoke the deployment
aws lambda invoke --function-name create --payload file://mocks/create-event.json out.txt
here is the relevant lambda code:
try {
await dynamoDbLib.call("put", params); //OK locally and in deployment
var lambda = new AWS.Lambda();
const req = {
FunctionName: 'eqtor-api-dev-mysim',
InvocationType: 'RequestResponse',
LogType: 'Tail',
Payload: JSON.stringify({ name: 'me' })
};
const result = await lambda.invoke(req).promise(); //OK locally but not in deployment
console.log(result);
return success(params.Item);
} catch (e) {
return failure({ status: false });
}
The command shows
{
"ExecutedVersion": "$LATEST",
"StatusCode": 200
}
and in out.txt, I get
{"statusCode":500,"headers":{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":true},"body":"{\"status\":false}"}
Any tips on how to debug this?