APIGateway returns lambda response object instead of body of the response
See original GitHub issueMy code:
export function handler(event: APIGatewayEvent, context: Context) {
try {
const app: Application = getExpressApp();
const server = awsServerlessExpress.createServer(app);
return awsServerlessExpress.proxy(server, event, context);
} catch (err) {
context.fail('Failed to start server on lambda');
}
}
The response if a make a request through api gateway:
But i was expecting to just get the json body:
{
"message": "hello from backend"
}
Am i doing something wrong or is this expected behavior?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
APIGateway returns lambda response object instead of ...
I found my problem on the response which is the wrong configuration of the API Gateway. It should be configured as Lambda Proxy...
Read more >Set up an integration response in API Gateway
There is no need to map the Lambda function response to its proper HTTP response. To return the result to the client, set...
Read more >How to correctly formate the response for an AWS Lambda API?
I am using Api-Gateway to create an API that return the result of a Lambda. I am used to API responses in the...
Read more >API Gateway integration response setup for AWS Lambda
It's a very common strategy to create your function in AWS Lambda and create REST API on API Gateway and integrate them together,...
Read more >Integrating API Gateway — Lambda Responses - Medium
My Use Case. I shall focus on a Lambda function which may throw unexpected exceptions, errors and return a response. To make this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found my problem on the response which is the wrong configuration of the API Gateway. It should be configured as Lambda Proxy Integration, otherwise all headers will be visible on the response.
I propose to close this ticket as it is a configuration issue on the API Gateway.
Glad you figured it out. Thanks for the screenshots. Check out our example which I recommend using as a baseline and modifying from there. It uses SAM a d is a one-command deploy