Skip to content

Invoking a lamnda from a lambda fails in SAM local #207

@aleybovich

Description

@aleybovich

I have two lambdas runnignin SAM local, one of them (lambda1) is an api endpoint and it works fine. Now, I add another lambda (lambda2) and I want lambda1 to call it, so I add this code in lambda1:

const lambda = new aws.Lambda({ region: 'us-east-1' });
    lambda.invoke({
        FunctionName: 'lambda2',
        InvocationType: 'Event',
        LogType: 'None',
    }, (err, data) => {
        console.log(err); // ERR HAS AN ERROR
        cb(null, { statusCode: 200, body: data });
    });

And Lambda2 is this:

module.exports.handler = (event, context, cb) => {
    cb(null, true);
};

I get an error in the callback:

{"message":"connect ECONNREFUSED 192.168.65.1:8000","code":"NetworkingError","errno":"ECONNREFUSED","syscall":"connect","address":"192.168.65.1","port":8000,"region":"us-east-1","hostname":"docker.for.mac.localhost","retryable":true,"time":"2017-11-30T18:04:24.985Z"}

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions