502 Bad Gateway errors

I’m getting 502 Bad Gateway errors when trying to reach my (docker environment) web service.

Based Web service returning HTTP/1.1 502 Bad Gateway - #2 by shantanu, it sounds like Render may be trying to send me HEAD requests to figure out what port the server is running on. I don’t want to bother responding to HEAD requests, so I just set the environment variable PORT to the appropriate port number of my server. That affected my internal host:port value but I’m still seeing 502’s externally. I have not tested reaching the server internally.

I can see from the server logs that no incoming requests are making it through. Oddly enough I’m not seeing any HEAD requests in the logs either. In the Events tab I can see “Deploy failed: Timed out” events, but what exactly timed out? There’s no description.

The Shell tab is also not working, and is behaving as described in [bug report] Never ending "Reconnecting..." cycle in the Shell tab.

The service in question is srv-c0abfrlua9vt7i8f5v2g.

Any pointers are greatly appreciated!

Hi Samuela, I checked the service, and looks like the reason was that your service never built successfully. When the deploy fails (check for failed deploys in the events tab of your service page), you will not be able to access your service through the onrender address. So I recommend looking at your build event and resolving the issue causing the build to fail. The shell tab flickering is happening because of the same reason, since the service never successfully ran, you won’t be able to access the shell.

I’m not sure how the build could be failing… When I look in the logs I clearly see

Jan 29 07:03:23 PM  Listening on http://127.0.0.1:3001

which is printed by my server once it’s up and running.

Is there some other sense in which you mean the build failed?

Thanks for sending this over, it makes things clear. My bad, looks like it was not the build but the fact that your application is listening on 127.0.0.1 instead of 0.0.0.0. If you can change this in your code, then the issue should be resolved.

1 Like

Ahhh, gotcha! I’ll give that a shot. Thanks!

2 Likes