同步调用:如果函数被同步调用并且
被限制,lambda返回429错误,调用服务是
负责重试。ThrottleDereason错误代码解释了
是否遇到函数级限制(如果指定)或
帐户级别限制(请参阅下面的注释)。每种服务都可能有自己的
重试策略。例如,cloudwatch日志会重试失败的批处理
5次,每次重试之间有延迟。事件源列表
以及它们的调用类型,请参见支持的事件源。
Reference
我不确定我对上述句子的理解是否正确,如果我错了,请纠正我。
-
当lambda被节流时,它返回
429 Error
到API网关。
-
调用服务(在这里是api网关)重试请求。
然而,它并没有如预期的那样工作。下面是当lambda被限制时来自cloudwatch的api网关日志。
API-Gateway-Execution-Logs_3f1frvtwe4/sam-sm-test 2a38a4a9316c49e5a833517c45d31070 (bededbf0-73ae-11e8-87a2-f51933ef104f) Endpoint response body before transformations: {"Reason":"ReservedFunctionConcurrentInvocationLimitExceeded","Type":"User","message":"Rate Exceeded."}
API-Gateway-Execution-Logs_3f1frvtwe4/sam-sm-test 2a38a4a9316c49e5a833517c45d31070 (bededbf0-73ae-11e8-87a2-f51933ef104f) Endpoint response headers: {Connection=keep-alive, x-amzn-RequestId=bedfc624-73ae-11e8-bd28-6345cb3606c4, x-amzn-ErrorType=TooManyRequestsException, Content-Length=104, Date=Tue, 19 Jun 2018 10:51:39 GMT, Content-Type=application/json}
API-Gateway-Execution-Logs_3f1frvtwe4/sam-sm-test 2a38a4a9316c49e5a833517c45d31070 (bededbf0-73ae-11e8-87a2-f51933ef104f) Execution failed due to configuration error: Malformed Lambda proxy response
实际上,lambda返回
{"Reason":"ReservedFunctionConcurrentInvocationLimitExceeded","Type":"User","message":"Rate Exceeded."}
这是API网关(代理集成)的错误格式,因此,API网关返回
502 Error
客户端调用api。
我希望重试失败的请求。我该怎么办?