且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

AWS lambda api 网关错误“格式错误的 Lambda 代理响应"

更新时间:2023-01-18 12:50:00

通常,当您看到 Malformed Lambda proxy response 时,表示您的 Lambda 函数的响应与格式 API Gateway 不匹配正在期待,像这样

Usually, when you see Malformed Lambda proxy response, it means your response from your Lambda function doesn't match the format API Gateway is expecting, like this

{
    "isBase64Encoded": true|false,
    "statusCode": httpStatusCode,
    "headers": { "headerName": "headerValue", ... },
    "body": "..."
}

如果您没有使用 Lambda 代理集成,您可以登录 API Gateway 控制台并取消选中 Lambda 代理集成复选框.

If you are not using Lambda proxy integration, you can login to API Gateway console and uncheck the Lambda proxy integration checkbox.

此外,如果您看到间歇性Malformed Lambda proxy response,这可能意味着对您的 Lambda 函数的请求已被 Lambda 限制,您需要请求增加 Lambda 上的并发执行限制功能.

Also, if you are seeing intermittent Malformed Lambda proxy response, it might mean the request to your Lambda function has been throttled by Lambda, and you need to request a concurrent execution limit increase on the Lambda function.