Amazon web services 由于Lambda代理响应格式错误,通过API网关的Lambda函数失败
出于某种原因,无论我如何更改响应,AWS lambda都会返回502错误 Sun Mar 25 03:39:12 UTC 2018:之前的端点响应主体 转换: {“status”:200,“body”:“{\“Items\”:[],“Count\”:0,“ScannedCount\”:1}”,“isBase64Encoded”:false,“headers”:{“content type”:“application/json”} 我已确保将我的正文字符串化,并添加状态、标题和IsBase64编码属性。我尝试过改变标题并使其为空 为什么会出现这个错误 以下是lambda代码:Amazon web services 由于Lambda代理响应格式错误,通过API网关的Lambda函数失败,amazon-web-services,aws-lambda,aws-api-gateway,Amazon Web Services,Aws Lambda,Aws Api Gateway,出于某种原因,无论我如何更改响应,AWS lambda都会返回502错误 Sun Mar 25 03:39:12 UTC 2018:之前的端点响应主体 转换: {“status”:200,“body”:“{\“Items\”:[],“Count\”:0,“ScannedCount\”:1}”,“isBase64Encoded”:false,“headers”:{“content type”:“application/json”} 我已确保将我的正文字符串化,并添加状态、标题和IsBase64编码
var response = {
status : 200,
body : JSON.stringify(data),
isBase64Encoded : false,
headers : {"content-type" : "application/json"}
}
console.log(response)
callback(null, response);
API网关需要的是
statusCode
,而不是status