Skip to content

Support one Local Lambda calling another Local Lambda scenarios #510

@suneelthakur1980

Description

@suneelthakur1980

We are in process writing an integration test for lambda.

Here is the situation LambdaA calls LambdaB internally.
Now I am invoking sam lambda A which internally call lmbdaB... ON AWS console this is working but not able to work it from SAM local.

However, if lambaB invocation is removed from LambdaA, both lambda works fine in SAM LOCAL.

Is this supported by SAM local, any workaround to move forward?
code snippets

var AWS = require('aws-sdk');
AWS.config.region = 'eu-west-1';
var lambda = new AWS.Lambda();

exports.handler = function(event, context,callback) {

var params = {
FunctionName: 'lambda-B', // the lambda function we are going to invoke
InvocationType: 'RequestResponse',
LogType: 'Tail',
Payload: JSON.stringify(event,null,null)
};
lambda.invoke(params, function(err, data) {

const dataPayload=data.Payload;
console.log("------dataPayload-----"+dataPayload);
console.log("------Now it should work-----"+JSON.parse(dataPayload).errorType);
if (err) { context.fail(err);
} else {
context.succeed('Lambda_SIGNATURE said '+ JSON.stringify(data));
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions