I get a 504 GATEWAY_TIMEOUT http response after 60 seconds of page loading.
This is not the actual page that is being loaded than the process that is being executed. I expect this to take more than 60 seconds, and I tried to increase the timeout value, but that didn't help.
I use the express framework for routing, and I accept the job on EB (AWS Elastic Beanstalk). Since I increased all the timeout values ββthat I could find on EB and Load Balancers in the AWS console, I assume that this should be the application itself, which has a timeout of up to 60 seconds. However, maybe I'm wrong.
My code is:
router.get('/main',function(req, res, next) { req.connection.setTimeout(600000); mainProcess(res);
UPDATE:
Also, I tried a different approach. I added this code in app.js :
var connectTimeout = require('connect-timeout'); var longTimeout = connectTimeout({ time: 600000 }); app.use(longTimeout);
Did not help.
UPDATE2: I also tried increasing the timeout in /bin/www as follows:
var server = http.createServer(app); server.timeout=600000;
Update3: I noticed that the timeout is related to the nginx configuration. As my logs say: upstream timed out (110: Connection timed out) while reading response header However, I cannot find a way to edit the nginx configuration on an elastic beanstalk. I did some research, but it all seems to me non-standard and too tough for such a simple thing.
source share