Lambda continues to run after ApiGateway request timed out

0

I set up an API Gateway endpoint, Lambda integration, default timeout (29s).

The Lambda sleeps for 40 seconds, then logs.

We observe the following:

  • 29 seconds after issuing the request, we receive {"message": "Endpoint request timed out"}
  • 40 seconds in, the Lambda logs

Why does the Lambda continue to run AFTER the request timed out? Currently, we rely on this behaviour - is it safe to assume things will stay this way, or could this change?

Edited by: mjfroehlich on Apr 26, 2019 5:32 AM

2개 답변
1

Timeout happens in the API Gateway side, so Lambda will continue to execute your function. This is true for most HTTP client-server scenario. The client-side timeout does not guarantee to abort the execution in the server.

If you don't need to wait/return Lambda's response via API Gateway, then why don't you invoke it asynchronously?
https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-integration-async.html

AWS
답변함 5년 전
  • My Nodejs lambda function stalled on timeout. I have a Nodejs lambda function with a 60sec timeout. When the API timeout happens on the 29th sec my lambda function stalls and gets timed out after 60 seconds. It is not continuing execution as you said

0

Nice, thanks for the pointer!

답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠