1

From AWS documentation: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html#invoke-property

var params = {
   FunctionName: 'STRING_VALUE', /* required */
   ClientContext: 'STRING_VALUE',
   InvocationType: Event | RequestResponse | DryRun,
   LogType: None | Tail,
   Payload: Buffer.from('...') || 'STRING_VALUE',
   Qualifier: 'STRING_VALUE'
};
lambda.invoke(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
});

How do I specify http method, e.g. GET, POST, PUT, DELETE when calling lambda.invoke()?

1 Answer 1

3

lambda.invoke() invokes the Lambda function - HTTP methods are for invoking Amazon API Gateway routes, not a Lambda function.

A Lambda function just takes in an event.

Either call the Amazon API Gateway endpoint (which then invokes the Lambda), or just directly invoke the Lambda as above.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.