skip to Main Content

I’ve established a straightforward integration between API Gateway and Lambda. Upon invoking the gateway endpoint, I’m encountering an immediate 504 timeout after merely 1 second. This is evident in the logs, where API Gateway initiates the Lambda function call, and within 1 second, it returns with a timeout error.

Despite the rapid timeout, my Lambda function is indeed being invoked and performing its tasks, albeit well after the original request has received a 504 response. The Lambda function typically completes its execution within a maximum of 10 seconds, comfortably within the 29-second cap set by API Gateway.

What could be causing this discrepancy? Any insights or suggestions for resolving this issue would be greatly appreciated.

2

Answers


  1. Chosen as BEST ANSWER

    After checking again, the API Gateway timeout can be changed, you just can't update it to be below the lower bound or above the upper bound as per the docs.

    To change the timeout, I needed to view the integration request resource within the API Gateway. From there, I was able to change the timeout. After a redeploy, it's now working as expected.


  2. The rapid timeout issue between API Gateway and Lambda despite the Lambda function completing within 10 seconds might be due to the API Gateway’s timeout setting being lower than the Lambda execution time. You can adjust the API Gateway timeout setting to be higher than the Lambda execution time. I think that will resolve the issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search