Nginx 502 on Elastic Beanstalk (Node.js) since at least yesterday

0

I am deploying nestjs apps on the Elastic Beanstalk (node.js) platform since yesterday and most of the times it results in a 502 error from nginx on trying to access the app. I don't do any proxy configuration for elastic beanstalk when configuring the environment. It just choses nginx by default. On setting up cloudwatch logs I can see nginx erroring out with messages like these:

2024/04/04 10:41:53 [error] 11066#11066: *7 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "my-domain.random-stuff.ap-south-1.elasticbeanstalk.com"

Edit: I mentioned this has happened since yesterday because I was able to deploy stuff just fine 2 days before that. Also this may be relevant to the post made a few days ago on "upload and deploy" being blocked by some IMDS related settings.

2 Antworten
0

Hello.

Looking at the log, it seems that it is proxying to "http://127.0.0.1:3000/".
I believe that the problem is caused by not being able to access "http://127.0.0.1:3000/".
What kind of service is running on "http://127.0.0.1:3000/"?

profile picture
EXPERTE
beantwortet vor einem Monat
profile picture
EXPERTE
überprüft vor einem Monat
profile picture
EXPERTE
überprüft vor einem Monat
0

Double-check your NestJS code to ensure it's configured to listen on port 3000. If not, update the code to use the correct port Log into your environment and use commands like ps aux | grep node to see if your Node.js process is running. In your EC2 console, examine the security group assigned to your Elastic Beanstalk instances.

If possible, temporarily create a very basic Node.js app (basic HTTP server) and deploy it on your Elastic Beanstalk environment. If this works, it helps isolate whether the issue is with your NestJS app or the Beanstalk configuration.

profile picture
EXPERTE
beantwortet vor einem Monat

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen