502 Gateway (Timeout?) Error On Previously Working API Endpoint


I’m using a stack with Angular for the Frontend and Python/Flask for the backend. I have followed the startup guide to add the validation decorators to endpoints in my backend and they largely work.

However, there are two endpoints that have started giving me 502 server responses (and don’t actually seem to enter the function) only after Auth0 has been added to my Flask app. It doesn’t seem to matter if I leave the endpoint unprotected (ie no decorator) or not. This endpoint worked fine before adding Auth0 to the app.

The only unique thing about these two endpoints are that a large Base64 encoded image is sent to the backend (around 134kb for the encoded image). After the image is decoded I upload this to a Storage Bucket in Google Cloud.

Are there any middle-ware or global configurations implicit with Auth0 being added to a Flask app?

I’m stuck on this.

If you need code examples, please let me know

Ok, I solved it myself and it isn’t directly related to Auth0 but it seems that adding Auth0 to my application consumed enough additional resources that my deployment configuration couldn’t handle the load when receiving a http request with a larger size

I reconfigured my gunicorn deployement from

entrypoint: gunicorn -b :8080 -w 1 main:app


entrypoint: gunicorn -b :8080 -w 2 -k gthread --threads 4 --timeout 120 main:app

In my app.yaml file that is used to configure my deployment to Google App Engine

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.