I read here that I can set my Lambda function timeout for 15 minutes (https://aws.amazon.com/about-aws/whats-new/2018/10/aws-lambda-supports-functions-that-can-run-up-to-15-minutes/)
However, when I try to set API Gateway inside the Integration Request settings, it does not allow me to set it higher than 29seconds:
How can I have a function that lasts 15 minutes, but a Gateway that time outs after 30 seconds?
If it's an HTTP API, you can try increasing your maximum integration request timeout parameter. Note: API Gateway REST API's default maximum integration timeout is 29 seconds. For HTTP API the timeout can be configured for up to the maximum value of 30 seconds.
You can now customize the timeout value for API integrations in Amazon API Gateway. You can set the maximum amount of time an integration will run before it returns without a response.
To request a quota increase, you can use Service Quotas or contact the AWS Support Center . When authorization is enabled on a method, the maximum length of the method's ARN (for example, arn:aws:execute-api:{region-id}:{account-id}:{api-id}/{stage-id}/{method}/{resource}/{path} ) is 1600 bytes.
Unfortunately there isn't a way to increase the API Gateway timeout to longer than 29 seconds. This is a limitation of the gateway. The reason you can set the lambda function longer is because this can be plugged into other AWS resources that allow a higher threshold for timeout processing.
Here's some options you could explore to get around this and/or work with the limitation:
Split your function out into smaller functions and chain those together to see if you get a performance increase. Before doing so you could use AWS X-Ray to debug the function and see what part is taking the most time to target what needs to be split out.
Increase the memory used by the function. Higher memory allocation could result in faster execution. I have used this option before and was able to work around timeout limits.
Instead of using API Gateway you could just use AWS SDK to call 'invoke()' which will invoke your lambda function. This will bypass the timeout threshold.
Hopefully one or a mix of those will help out :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With