【发布时间】:2017-02-06 22:07:53
【问题描述】:
我在 ECS 集群中部署了微服务,其中应用程序负载均衡器和目标组配置为它的前端。
现在,我在使用应用程序负载平衡器时遇到的一个问题是,有时响应需要超过 3 秒。我正在尝试调查它发生了什么。
现在,当我在 API 网关中创建资源和 POST 方法并将 HTTP 端点配置为服务的应用程序负载均衡器时,我看到的是在某些情况下它会给出以下错误:
Status: 504
Latency: 3026 ms
Response Body
{
"message": "Network error communicating with endpoint"
}
Execution log for request test-request
Mon Feb 06 21:47:00 UTC 2017 : Starting execution for request: test-invoke-request
Mon Feb 06 21:47:00 UTC 2017 : HTTP Method: POST, Resource Path: /find
Mon Feb 06 21:47:00 UTC 2017 : Method request path: {}
Mon Feb 06 21:47:00 UTC 2017 : Method request query string: {}
Mon Feb 06 21:47:00 UTC 2017 : Method request headers: {}
Mon Feb 06 21:47:00 UTC 2017 : Method request body before transformations:
Mon Feb 06 21:47:00 UTC 2017 : Endpoint request URI: http://microservice-alb-xxxxxxx.us-east-1.elb.amazonaws.com/find
Mon Feb 06 21:47:00 UTC 2017 : Endpoint request headers: {x-amzn-apigateway-api-id=hw4gf0e5ui, Accept=application/json, User-Agent=AmazonAPIGateway_hxyf0t7ui, X-Amzn-Trace-Id=Root=1-456twed4-97d26555a0abcd123413ad35}
Mon Feb 06 21:47:00 UTC 2017 : Endpoint request body after transformations:
Mon Feb 06 21:47:03 UTC 2017 : Execution failed due to an internal error
Mon Feb 06 21:47:03 UTC 2017 : Method completed with status: 504
有几次它工作正常并给出正确的响应,状态码为 200,有几次它给出上述响应。在 API Gateway 中执行 Test 以及资源部署到阶段并通过阶段访问时的行为也是如此。
我已打开应用程序负载均衡器的访问日志,并通过覆盖 API 网关中的阶段设置启用了云监视日志。但是我没有得到任何关于这个错误的详细信息。
如何解决 API 网关中出现此错误的原因?
谢谢,
兰吉斯
【问题讨论】:
标签: aws-api-gateway amazon-ecs