Skip to content
Advertisement

Javascript: How to specify http method with AWS Lambda.invoke()?

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

JavaScript

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

Advertisement

Answer

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.

Advertisement