1
votes

Since the discussion forums of Amazon gave an error im posting the question here.

We are running a single nodejs (api) instance with Elastic Beanstalk. After 4 months of usage, suddenly the POST request for creating users failed with a 504 Gateway Time-out. No modification were made to the code or elastic beanstalk config in the meantime whatsoever. The rest of the requests are working correctly. When testing locally there are no errors. In the nginx error log the following occurs: Upstream timed out (110: Connection timed out) while reading response header from upstream. Tried Apache as a proxy and this gave a similar error.

Environment

  • 64bit Amazon Linux 2016.03 v2.1.0 running Node.js
  • Nodejs 4.3.0
  • Nginx 1.8.1

After trying almost everything we are out of options. Any suggestions?

Thanks in advance, Mk

1
Does the post request work when trying to run it from the local server? Try sshing into the server (you can do this using the eb cli) and posting your request to localhost:<app-port>.Yaron Idan
Sshed to my server and tried the post request by using localhost:8081 and the remote eb url. With wget I got the following response when trying localhost: HTTP request sent, awaiting response... No data received. When trying the remote eb url I got a 504 Gateway time-out.mkshake
@mkshake did you fix that issue? I have a similar problemdemsey
Yeah I finally did solve the problem. Within the mongoose user model the validation function did not work properly when deployed. Dont know why.mkshake

1 Answers

1
votes

If you're using an ELB, try setting the "Idle Timeout" to a higher time value. You can do this using the AWS CLI:

aws elasticbeanstalk update-environment --environment-name your-env-name --option-settings Namespace=aws:elb:policies,OptionName=ConnectionSettingIdleTimeout,Value=300

I'm not sure if you can do this from the UI but I don't think so.