API网关超时

时间:2019-10-22 14:29:04

标签: node.js amazon-web-services rest api aws-api-gateway

我有这个并且一直在超时。在NODEJS中。我试图添加回调,但没有任何改变。

错误:

{
  "errorMessage": "2019-10-22T14:25:09.783Z c813ce95-45e8-4e52-93b6-0cc75ab84f66 Task timed out after 3.00 seconds"
}

API代码:

// getAll
controller.getAll = async (req, res) => {
  const responser = responserFor(res);
  const stars = await Stars.find();

  responser.send(stars);
  context.succeed("done");
};

控制台日志:

Execution log for request c4085c4d-17c6-4ee8-b6ba-05ea9cb6b9e3
Tue Oct 22 14:25:06 UTC 2019 : Starting execution for request: c4085c4d-17c6-4ee8-b6ba-05ea9cb6b9e3
Tue Oct 22 14:25:06 UTC 2019 : HTTP Method: GET, Resource Path: /stars
Tue Oct 22 14:25:06 UTC 2019 : Method request path: {}
Tue Oct 22 14:25:06 UTC 2019 : Method request query string: {}
Tue Oct 22 14:25:06 UTC 2019 : Method request headers: {}
Tue Oct 22 14:25:06 UTC 2019 : Method request body before transformations: 
Tue Oct 22 14:25:06 UTC 2019 : Endpoint request URI: https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-east-1:778265920111:function:starme-test-api/invocations
Tue Oct 22 14:25:06 UTC 2019 : Endpoint request headers: {x-amzn-lambda-integration-tag=c4085c4d-17c6-4ee8-b6ba-05ea9cb6b9e3, Authorization=**************************************************************************************************************************************************************************************************************************************************************************************6a6280, X-Amz-Date=20191022T142506Z, x-amzn-apigateway-api-id=nbj1099rnd, X-Amz-Source-Arn=arn:aws:execute-api:us-east-1:778265920111:nbj1099rnd/test-invoke-stage/GET/stars, Accept=application/json, User-Agent=AmazonAPIGateway_nbj1099rnd, X-Amz-Security-Token=AgoJb3JpZ2luX2VjEPb//////////wEaCXVzLWVhc3QtMSJIMEYCIQCcHoOKGq2LSjfxkIsA+ROWlpFjC+19bh8RmzXWezmz7AIhANjk3NdBDzhlEaDrLl7lyEsiIubUktP/ditICI0revqVKuMDCO///////////wEQABoMMzkyMjIwNTc2NjUwIgzmTz5nzkZJqdEtoNUqtwMTLNRvjTO+5uBlS6NpIOG1gz8sH6KjJGt0np2FBrBjYl02XCQtksUuKtaJ31CPJp8g+TfRnlCOpjZllI7k4J95/ViAR2ZopXYD8wF9JoAlWO95e/k2ZT+0ar5Nd9wAT5IBVjLLyadxzADTIrMOrYftJjnZcOkl8Vm0XJrvFqe/t [TRUNCATED]
Tue Oct 22 14:25:06 UTC 2019 : Endpoint request body after transformations: 
Tue Oct 22 14:25:06 UTC 2019 : Sending request to https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-east-1:778265920111:function:starme-test-api/invocations
Tue Oct 22 14:25:09 UTC 2019 : Received response. Status: 200, Integration latency: 3026 ms
Tue Oct 22 14:25:09 UTC 2019 : Endpoint response headers: {Date=Tue, 22 Oct 2019 14:25:09 GMT, Content-Type=application/json, Content-Length=114, Connection=keep-alive, x-amzn-RequestId=c813ce95-45e8-4e52-93b6-0cc75ab84f66, X-Amz-Function-Error=Unhandled, x-amzn-Remapped-Content-Length=0, X-Amz-Executed-Version=$LATEST, X-Amzn-Trace-Id=root=1-5daf1142-d4ea5da705ccaf18d4993b38;sampled=0}
Tue Oct 22 14:25:09 UTC 2019 : Endpoint response body before transformations: {"errorMessage":"2019-10-22T14:25:09.783Z c813ce95-45e8-4e52-93b6-0cc75ab84f66 Task timed out after 3.00 seconds"}
Tue Oct 22 14:25:09 UTC 2019 : Method response body after transformations: {"errorMessage":"2019-10-22T14:25:09.783Z c813ce95-45e8-4e52-93b6-0cc75ab84f66 Task timed out after 3.00 seconds"}
Tue Oct 22 14:25:09 UTC 2019 : Method response headers: {X-Amzn-Trace-Id=Root=1-5daf1142-d4ea5da705ccaf18d4993b38;Sampled=0, Content-Type=application/json}
Tue Oct 22 14:25:09 UTC 2019 : Successfully completed execution
Tue Oct 22 14:25:09 UTC 2019 : Method completed with status: 200

0 个答案:

没有答案