Api Gateway Websocket API 30s timeout


This might be the same issue as mentioned in this Stackoverflow thread https://stackoverflow.com/questions/61617193/aws-api-gateway-websocket-timeout

We have Websocket API set up and it is working well for messaging between frontend, websocket and lambda integration under 30s. but it would receive a message saying "Endpoint request timed out" after about 30s

How to make it run for more than 30s? According to the limit documentation, it should have 10 minutes idle time. https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html

1 Answer

Looking at the settings in the following document, the default timeout setting value seems to be 29 seconds.
I thought that perhaps this timeout value limitation prevented execution for more than 30 seconds.
Also, the maximum value would be 29 seconds, since the set value is 50-29,000 milliseconds.

profile picture
answered a year ago
  • yes, indeed, there is 29s timeout setting. How should I configure it so that it can have more than 29s timeout and have the 10 minute idle time?

  • Idle timeout and integration timeout are different setting values. Integration timeout is a timeout about the processing of the API. In other words, it is a function to time out when the API process has become too long. Idle Timeout is a setting for the amount of time to maintain a connection between the client and the API Gateway. This means that the connection can be reused until the idle timeout expires.
    In your case, it seems that you want to run an API that requires more than 30 seconds of processing, but the timeout value related to the execution time is the integration timeout, so setting an idle timeout will not increase the execution time. Also, the integration timeout can only be set to 29 seconds, so I don't think it is possible to run it for more than 30 seconds. If you need to process more than 30 seconds, it is recommended to create an asynchronous system.

  • yes, I need more than 30s processing time which is limited by the integration timeout limit of 29s. What services should I use to make an asynchronous system?

  • SQS is a typical service used in asynchronous systems. You can create an asynchronous system by having Lambda or other services start when a message is stored in SQS. https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-lambda-function-trigger.html

  • If I want to use it to build a heartbeat service, what service should I use to check a heartbeat from many frontend clients in a set interval like 30s? If the service doesn't receive a heartbeat from the client, it should update the client status in the database.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions