作为如何将 AWS API Gateway 超时设置为高于 30 秒?,我已成功将该区域的账户级服务配额超时增加到 120,000 毫秒,超过默认值 29,000 毫秒(旨在通过基岩处理下游 LLM 调用)。
我有以下 cloudformation 模板片段,我在其中添加了增加的超时。
但是,根据我的前端客户端,网关仍然超时,504,29秒!
更新是否没有得到尊重或传播?是地域问题吗? HTTP 与 REST 类型?
请帮忙,谢谢!
MyApiMethod:
Type: AWS::ApiGateway::Method
Properties:
HttpMethod: "POST"
ResourceId: !Ref MyApiResource
RestApiId: !Ref MyApi
AuthorizationType: "NONE"
Integration:
Type: "AWS_PROXY"
IntegrationHttpMethod: "POST"
Uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${PrimaryLambdaFunction.Arn}/invocations"
TimeoutInMillis: 120000 # Increased from default of 29 secs via account-level service quota increase
MethodResponses:
- StatusCode: '200' # Update to match the expected success status
ResponseParameters:
method.response.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
method.response.header.Access-Control-Allow-Methods: "'POST,OPTIONS'"
method.response.header.Access-Control-Allow-Origin: "'*'"
我必须在 cloudformation 模板中将协议设置为 REGIONAL 才能完成这项工作。
MyApi:
Type: AWS::ApiGateway::RestApi
Properties:
Name: "MyApp"
EndpointConfiguration:
Types:
- REGIONAL
感谢@derpirscher 的指导和启发!