New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Migrated] Getting Gateway Timeouts (504), Despite Setting timeout_seconds to 120 #916
Comments
The API Gateway and Cloudfront timeouts are 30 seconds and cannot be changed. The https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-requirements-limits.html https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html |
APIGW has a 30 second timeout. closing. |
What can be done to avoid it? Any workarounds? |
We can't modify APIGW max timeout, what's your use case and why do you need to run it for more than 30 sec? |
@sridhar562345 |
Hi @JacobDel, I think you can keep the main lambda warm and make those API calls async, Plus to keep lambda warm make those warm calls to an endpoint which doesn't ping your other APIs. |
Thank you for your response @souravjamwal77 . |
@JacobDel, you can create a seperate dummy endpoint to keep warm. Or whenever you're getting a request check if it's coming a user or it's a keep warm call. Then, if the call came from AWS do nothing and return a true response. And if this call is from a user then start hitting your other lambdas asynchronously and load data on the front side asynchronously. |
Instead of using a slim handler, why don't you try to deploy your app as a docker image? So your initialization times will be reduced. |
@souravjamwal77 I created a timed event like you mentioned but that did not create a difference, even with an expression rate of 1minute. thank you guys for solving my problem! |
Originally from: Miserlou/Zappa#2182 by JordanTreDaniel
I have deployed a lambda that performs image manipulation, which can take a while sometimes. Longer than 30 seconds is a normal, expected time (for some photos)
At first, the timeout was showing in the
zappa tail
logs, but now, after setting thetimeout_seconds
option to 120, it seems as though the Amazon Cloudfront/Amazon Gateway is still enforcing a 30-second limit. I have dug around on AWS, and it seems I can only change this from a Cloudfront console. I don't believe there is an Cloudfront Distribution for this Lambda.I am running on python 3.6
Expected Behavior
I would think that if I set the
timeout_seconds
to 120 in the Zappa settings, zappa would apply that setting to not only the lambda, but also whichever gates stand in front of it. (Gateway OR CloudFront Dist)Actual Behavior
I get 504's when I don't choose to have the lambda downsample the image. (When it's normal for it to take long)
Possible Fix
Is there a way to apply the
timeout_seconds
to more than just the Lambda itself?Steps to Reproduce
downSample
option.Your Environment
pip freeze
:zappa_settings.json
:The text was updated successfully, but these errors were encountered: