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:
- 'Use the SDK' to invoke the Lambda, which I guess means change the integration type to 'AWS service' and trigger the Lambda there? (https://stackoverflow.com/a/54300708/2950747)
- Invoke one Lambda which invokes the long-running Lambda (https://stackoverflow.com/a/35874753/2950747)
- Lambda to SQS to long-running Lambda (https://stackoverflow.com/a/57241280/2950747)
- Set the Lambda to be asynchronously invoked with a
X-Amz-Invocation-Type
header (https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-integration-async.html) - Using
Event
invocation type (https://github.com/serverless/serverless/issues/3171#issuecomment-539664429) - This project (https://github.com/zeoagency/aws-api-gateway-timeout-increaser)
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?