Home > Software design >  How to solve AWS Elastic Beanstalk 504 Timeout Error?
How to solve AWS Elastic Beanstalk 504 Timeout Error?

Time:05-07

I am using AWS Elastic Beanstalk for hosting Express/Node.js API server. It's working well with just normal APIs but I am getting this 504 Timeout error with only one API which may take time for more than 20 mins at max. So, I thought I needed to increase max request time of Nginx and Node.js server and I did it by configuring AWS EB .extensions and .platform variables.

Here is what I did.

.platform/nginx/conf.d/timeout.conf

client_header_timeout 3000s;
client_body_timeout 3000s;
send_timeout 3000s;
proxy_connect_timeout 3000s;
proxy_read_timeout 3000s;
proxy_send_timeout 3000s;

.ebextensions/network.config

option_settings:
    - namespace: aws:elasticbeanstalk:command
      option_name: Timeout
      value: 3000

But I am still getting this error and I can't understand why this is happening.

  • Plus Note: Elastic Beanstalk server is covered by CloudFront and AWS Route 53 for giving it public domain address and HTTPS connection.

If somebody knows how to fix this, it will be appreciated a lot.

CodePudding user response:

In case you are using a "Load balanced" environment type, check the "Connection idle timeout" setting of the Load Balancer.

To validate if your env uses a ELB go to "Elastic Beanstalk" -> "<your_environment> -> "Configuration" section and check if the "Load balancer" category is present. Here you can find also the type of ELB you are using. Then change the Connection idle timeout setting in the EC2 console to a proper value.

  • Related