502 Bad Gateway on Render even with app.listen(PORT, '0.0.0.0')

I’m deploying a simple Node.js Express app on Render.

I’m using the following to start the server:

app.listen(process.env.PORT, '0.0.0.0', () => {
  console.log(`Server running`);
});

Everything seems correctly set:

  • PORT is read from process.env.PORT
  • All required environment variables are added in the Render dashboard
  • start script in package.json is:
"start": "node index.js"

  • Deployment logs show the server is starting without errors

However, after redeploying, I get a 502 Bad Gateway error when accessing the service.

Is there anything else I should check specific to Render’s platform?

Thanks in advance.

1 Like