2

I have a problem regarding my Node app that I am running in AWS. Everything has been working fine until today.

Without any new deployment to the app, I am getting this 502 error when I try to access the URL.

I have checked the nginx logs, and Im getting this:

2020/10/11 01:24:55 [error] 4735#0: *1 connect() failed (111: Connection refused) while connecting to upstream, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8080/favicon.ico", host: "mydomain.com", referrer: "mydomain.com"

I have tried to create a new security group with new inbound rules but it didnt work, has there been ane "new" update on EB configuration Im missing?

Thanks in advance.

Ben C.
  • 39
  • 1
  • 1
  • 6
  • If you ssh to the EB instance, can you curl your app from inside? – Marcin Oct 11 '20 at 04:23
  • `Connection refused` usually means the server is not listening on the target port. Is your node app even running? – gusto2 Oct 11 '20 at 19:27
  • Yes @Marcin, I am able to curl but I get the same error: 502 Bad Gateway

    502 Bad Gateway


    nginx/1.18.0
    – Ben C. Oct 11 '20 at 19:37
  • Yes @gusto2, it's runnning and the status is "Ok" – Ben C. Oct 11 '20 at 19:38
  • The message from the nginx and the logs are saying that nginx is trying to connect to `localhost:8080` and the server tells that nobody listens there. Marcin is asking if you can curl the backend directly (port 8080) not the nginx proxy – gusto2 Oct 11 '20 at 19:44

2 Answers2

3

enter image description hereIf you are using python > 3.6 on eb. Then eb will use gunicorn to run your django app. So you need to install gunicorn with pip install gunicorn also mention it in requirements.txt with pip freeze requirements.txt and most important thing is You need to create "Procfile" in your project root where manage.py is located. "Procfile" will have no extension. "Procfile" content is below: web: gunicorn --bind :8000 --workers 3 --threads 2 ebdjango.wsgi:application in place of ebdjango put you project name and deploy with eb deploy. Thanks!

0

I got exactly the same problem exactly at the same time than you. My solution was to remove the start of the program from index.js to the app.js. After that everything works fine again. For the some reason aws does not start index.js file anymore.

Allegro
  • 1
  • 1