Lambda函数通过API网关失败,原因是Lambda代理响应格式不正确。

4
由于某些原因,我的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"}}
我确保对我的主体进行了字符串化,并添加了状态、标头和isBase64Encodeded属性。我尝试过改变标头并使它们为空。
为什么会出现这个错误?
以下是Lambda代码:
    var response = {
        status : 200,
        body : JSON.stringify(data),
        isBase64Encoded : false,
        headers : {"content-type" : "application/json"}
    }

    console.log(response)

    callback(null, response);
网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接