Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 由于Lambda代理响应格式错误,通过API网关的Lambda函数失败_Amazon Web Services_Aws Lambda_Aws Api Gateway - Fatal编程技术网

Amazon web services 由于Lambda代理响应格式错误,通过API网关的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编码

出于某种原因,无论我如何更改响应,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代码:

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

    console.log(response)

    callback(null, response);

API网关需要的是
statusCode
,而不是
status