'Error H12 "Request timeout" on heroku for django application
I am getting the H12 "Request timeout" error when I am working with large data in a CSV file and when the data in the CSV file is less the app is working fine.
The logs that I am getting is :
2022-02-27T06:05:20.963369+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/" host=youtube-channel-list.herokuapp.com request_id=36c5fe9b-21c5-40de-8804-a75786dfd32e fwd="27.97.65.233" dyno=web.1 connect=0ms service=30699ms status=503 bytes=0 protocol=https
I updated my Procfile also as:
web: gunicorn channelList.wsgi --timeout 120 --keep-alive 5 --log-level debug --log-file -
But still, the same error is coming. What exactly do I need to do? If you need more information, I am ready to provide it.
Solution 1:[1]
This topic has already been discussed on various similar questions like here or here.
The bottom line is that you cannot increase the 30 second limit as mentioned on Heroku's official docs.
The timeout value is not configurable. If your server requires longer than 30 seconds to complete a given request, we recommend moving that work to a background task or worker to periodically ping your server to see if the processing request has been finished. This pattern frees your web processes up to do more work, and decreases overall application response times.
You need to need handle the file upload differently, and the two questions linked above discuss a couple of different strategies that might work for you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | drosenberger |