siddharth
siddharth

Reputation: 1

I have to test lambda locally when API(API Gateway) is called

For a lambda function, I have a API gateway as a trigger, I want to test this locally how can I do that

I have read about lambda-local, Want to know how to give event json to lambda, how an event for the API gateway is generated, suppose if it is not API gateway but a s3 event then how will I know what kind of event json needs to be passed ..please explain

lambdaLocal.execute({
    event: jsonPayload,
    lambdaPath: path.join(__dirname, 'path_to_index.js'),
    profilePath: '~/.aws/credentials',
    profileName: 'default',
    timeoutMs: 3000
}).then(function(done) {
    console.log(done);
}).catch(function(err) {
    console.log(err);
});

Upvotes: 0

Views: 23

Answers (0)

Related Questions