AWS API Gateway:请求主体很大但大小未超出限制时,API调用将失败

时间:2019-08-30 06:34:46

标签: aws-api-gateway

我正在自学AWS API Gateway。

我正在尝试创建一个API终结点,该终结点可以处理具有对象数组的POST请求。该数组如下所示。

[
  {
    "id": "10062",
    "name": "John Smith",
    "age": "40",
    "address": "Blah Blah st, 1436 Sample Hill"
  }
  ,
  {
    "id": "10063",
    "name": "Amanda Smith",
    "age": "37",
    "address": "ABC Center, 1316 XYZ"
  }
// many other similar JSON objects here
]

当数组的长度小于20时,API路由会正常工作。但是,如果对象数目大于该数目,则它将失败。

最让我感到困惑的是,AWS API Gateway并未在错误消息中描述原因。

在CloudWatch中,错误记录为...

Endpoint response body before transformations:
{
    "statusCode": 500,
    "headers": {
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Allow-Credentials": true
    },
    "body": "{\"status\":false}"
}

它仅说明"{\"status\":false}",但是如何检查实际上是什么导致了错误?

最重要的是,根据the official doc,API网关的有效负载限制为10 MG。就我而言,请求有效负载肯定小于该值。

您如何处理到AWS API Gateway的大请求有效负载?任何建议将不胜感激。

0 个答案:

没有答案