Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS API Gateway Timeout after ~30 seconds

AWS API Gateway timeout after around 30 seconds. I connected the API gateway to a lambda function that runs far longer than 30 seconds.

So the API response times out after around ~30 seconds and give back something like a timeout response.

How do I solve this problem and get my response back from Lambda?

Thank you.

like image 497
Bo Peng Avatar asked Sep 04 '26 20:09

Bo Peng


1 Answers

The API Gateway has a maximum integration timeout of 30 seconds (API Gateway Limits), so there is nothing you can do to increase it.

What you could do is accept the request, create and ID and put it in a queue. Then you send an HTTP 202 Message with the request id back to the client. Now a Lambda function can be triggered from the Queue asynchronously that performs the work. It later persists the results of the query somewhere under the request id (maybe only for a period of time). The client can then use the request ID and poll a second API gateway for the status, which is able to return the response once it's present.

like image 78
Maurice Avatar answered Sep 06 '26 11:09

Maurice