0 votes
1 view
in AWS by (19.2k points)

I am trying to set up a hello world example with AWS lambda and serving it through API gateway. I clicked the "Create a Lambda Function", which set up the API gateway and selected the Blank Function option. I added the lambda function found on AWS gateway getting started guide:

exports.handler = function(event, context, callback) {

  callback(null, {"Hello":"World"});  // SUCCESS with message

};

The issue is that when I make a GET request to it, it's returning back a 502 response { "message": "Internal server error" }. And the logs say "Execution failed due to configuration error: Malformed Lambda proxy response".

1 Answer

0 votes
by (44.6k points)

If the API Gateway expecting format and your Lambda function’s response does not match, you will receive a Malformed Lambda proxy response.

{

    "isBase64Encoded": true|false,

    "statusCode": httpStatusCode,

    "headers": { "headerName": "headerValue", ... },

    "body": "..."

}

If you do not want to use Lambda proxy integration, then just log on to API Gateway console and uncheck the box which says the same.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...