Due to Malformed Lambda proxy response my lambda function through API gateway fails

0 votes

Getting a 502 error on AWS lambda

Sun Mar 25 03:39:12 UTC 2018 : Endpoint response body before transformations: {"status":200,"body":"{\"Items\":[],\"Count\":0,\"ScannedCount\":1}","isBase64Encoded":false,"headers":{"content-type":"application/json"}}

Using stringify to my body and add the status, headers, and isBase64Encodeded properties.

I have tried varying the headers and making them empty as well.

Why do i get this error?

The lambda code i am using is as follows:

    var response = {
        status : 200,
        body : JSON.stringify(data),
        isBase64Encoded : false,
        headers : {"content-type" : "application/json"}


    callback(null, response);

Nov 2, 2018 in AWS by findingbugs
• 3,140 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can refer to the following documentation by AWS.

API Gateway expects statusCode, not status.


answered Nov 2, 2018 by Priyaj
• 56,120 points

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers
+1 vote
3 answers

Not able to pass params POST to AWS Lambda from Amazon API Gateway

For this template : application/x-www-form-urlencoded  This line below will ...READ MORE

answered Jun 13, 2018 in AWS by Cloud gunner
• 4,240 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.