exports.handler = function(event, context, callback) callback(null, "Hello":"World"); // SUCCESS with message;The problem is that as soon as I make a acquire request to it, it"s returning ago a 502 an answer "message": "Internal server error" . And also the logs to speak "Execution failed as result of configuration error: Malformed Lambda proxy response".
You are watching: Execution failed due to configuration error: malformed lambda proxy response
Usually, as soon as you view Malformed Lambda proxy response, it method your solution from her Lambda function doesn"t enhance the layout API Gateway is expecting, choose this
false, "statusCode": httpStatusCode, "headers": "headerName": "headerValue", ... , "body": "..."If you are not utilizing Lambda proxy integration, you have the right to login to API Gateway console and also uncheck the Lambda proxy integration checkbox.
Also, if you space seeing intermittent Malformed Lambda proxy response, it can mean the inquiry to her Lambda role has been throttled through Lambda, and you must request a concurrent execution limit rise on the Lambda function.
See more: Similar Movies Like The Girl With All The Gifts Streaming Online
If lambda is used as a proxy then the solution format have to be
false,"statusCode": httpStatusCode,"headers": "headerName": "headerValue", ... ,"body": "..."
Note : The body must be stringified
Yeah so ns think this is because you"re no actually return a suitable http response there i beg your pardon is why you"re gaining the error.
personally I use a set of functions like so:
module.exports = success: (result) => return statusCode: 200, headers: "Access-Control-Allow-Origin" : "*", // compelled for CORS assistance to work "Access-Control-Allow-Credentials" : true // forced for cookies, authorization headers v HTTPS , body: JSON.stringify(result), , internalServerError: (msg) => return statusCode: 500, headers: "Access-Control-Allow-Origin" : "*", // forced for CORS support to occupational "Access-Control-Allow-Credentials" : true // forced for cookies, authorization headers with HTTPS , body: JSON.stringify( statusCode: 500, error: "Internal Server Error", internalError: JSON.stringify(msg), ), // add much more responses here.Then you just do:
var responder = require("responder")// some codecallback(null, responder.success( message: "hello world"))