0

I've got a Lambda function which is invoked by a Gateway websocket API. The Lambda does some 3D data processing and takes a minute or two to complete at max memory. I can't break it down to take <30s. I'm running into the Endpoint request timed out error caused by the 29s default timeout.

(I thought the websocket would invoke the Lambda asynchronously, but I guess it doesn't? Also the 29/30s limit is mentioned as a quota for HTTP APIs but not for websockets in the docs).

From looking around, I can see a few options recommended:

Some of these options are a couple of years old & there might be better ways now.

Am I missing a setting somewhere? I don't really understand why a websocket API (which doesn't wait for the Lambda's response, like a HTTP/REST API does) is subject to a 30s timeout. Assuming it is, are the above methods still the best/simplest way to work round the timeout?

user2950747
  • 695
  • 1
  • 6
  • 19
  • 2
    Not sure what you are building, but I think you are chasing the wrong solution. If your Lambda takes so long to process the 3D data, maybe it would make sense to add a callback URL to your request, which is called once the 3D data is processed. This way, your Gateway Lambda can just create a processing job and return immediately. Once the job is done it can send a request to the previously provided callback URL and send the result. This way it does not matter if you need 30s, 45s or 120s. But hard to tell from the limited information if that would work. – Jens Mar 28 '21 at 01:32
  • 29 second limit applies to everything. You simply can't have APi gateway waiting for more then that for your lambda. Use different solution, as @Jens suggested. – Marcin Mar 28 '21 at 02:56
  • `This way, your Gateway Lambda can just create a processing job and return immediately. Once the job is done it can send a request to the previously provided callback URL and send the result.` > Yes – am using websocket to talk back to the client (which works fine), but looks like I'll have to have something like Gateway > quick Lambda > SQS > long-running Lambda, and pass the event & connectionId through, so the long-running Lambda can push messages back to the client. – user2950747 Mar 28 '21 at 08:50
  • This blog post lists the services that can invoke Lambda synchronously and asynchronously (as of 2019, anyway): https://aws.amazon.com/blogs/architecture/understanding-the-different-ways-to-invoke-lambda-functions/ – user2950747 Mar 28 '21 at 08:53

0 Answers0