Categories
JavaScript Answers

How to fix AWS lambda API gateway error “Malformed Lambda proxy response” with JavaScript?

Spread the love

To fix AWS lambda API gateway error "Malformed Lambda proxy response" with JavaScript, we should return a response in the right format.

For instance, our response should have something like

{
  "isBase64Encoded": true,
  "statusCode": 200,
  "headers": { "headerName": "headerValue" },
  "body": "..."
}

The properties listed should be in the response JSON.

statusCode is the HTTP status code.

headers is an object with the response headers keys and values.

body is the response body.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *