red house 87
red house 87

Reputation: 2415

AWS Gateway timeout

I'm using a lambda function to process a large amount of data (which exceeds 30s) and I am receicing a message from AWS Gateway:

Endpoint request timed out

I understand this is obviously because of the default timeout with AWS Gateway, however my Lambda function is set to run for up to 15 minutes.

What is the best way to increase this timeout? Surely this can be done considering lambdas can be set to execute for a much longer time.

Thanks

Upvotes: 3

Views: 3855

Answers (3)

r.delic
r.delic

Reputation: 863

API Gateway has a hard limit of 30 seconds. If your lambdas regularly take over 30 seconds (and you really need to use an API endpoint instead of a schedule, SQS or other source), you should use the lambda behind the gateway to trigger another lambda that does the actual work and give a response something like { "file_id": "some_id", "status": "in_progress"}. Then fetch the result of the work from another API endpoint. And ideally you should also have another endpoint to check the status of the work so the user of the API knows when it is done and results are ready for download.

Upvotes: 4

dmigo
dmigo

Reputation: 3029

According to the documentation API Gateway times out after 30 seconds. And as of now it is not configurable.

Integration timeout 50 milliseconds - 29 seconds for all integration types, including Lambda, Lambda proxy, HTTP, HTTP proxy, and AWS integrations.

Upvotes: 2

Michael Goodrum
Michael Goodrum

Reputation: 79

API gateway times out after 30 seconds, have you tried using scheduled events to trigger the lambda instead of going through API gateway?

Upvotes: 2

Related Questions