lambda-api
lambda-api copied to clipboard
Process AWS SDK “Invoke” requests
There should be a way for Lambda API to process requests that bypass API Gateway and are invoked directly. Support for “RequestResponse” and “Event” invocations should be supported.
I have a use case where I would like to use lambda-api for a series of lambdas API Gateway. For testing/development purposes, I am invoking the lambda directly using the AWS Lambda client. When I do invoke the handler directly (setting the logger to debug) I see that the "route" is undefined, which results in a "Method not allowed" response. Are there any current workarounds that might be able to unblock at the moment? Thanks!
@austinfox If you want to invoke your lambda-api handler without using API Gateway, you can try passing an event object that is similar to the API Gateway format. The following examples should work a sample requests:
{
"httpMethod": "GET",
"path": "/test/path",
}
Sample POST request:
{
"body": "{\"value\":\"test\"}",
"httpMethod": "POST",
"path": "/test/path
}
See Input format of a Lambda function for proxy integration in AWS docs for more details and attributes.