Render 5xx errors and 502 Bad Gateway: find the cause and get alerted
Render 5xx errors most often start as a 502, returned when its proxy cannot get an answer from your web service. The process is not bound to 0.0.0.0:$PORT, it crashed mid-request, or a worker was killed by a timeout. Render charts requests by status code but sends no notification when 5xx errors rise. For the general picture, see 502 Bad Gateway.
Where Render shows 5xx errors
A web service’s Metrics page has a Total Requests chart you can group by status code. It counts only requests from the public internet, and keeps 7, 14 or 30 days depending on your workspace plan.
The usual causes of a Render 502
- 502 on every request right after a deploy: the app is not listening on
0.0.0.0:$PORT. - 502 on some requests: a worker was killed mid-request, by an out-of-memory kill or by the server’s own timeout, such as Gunicorn’s
--timeout. See Render out of memory. - Intermittent 502s on Node: the server closes keep-alive connections before Render’s proxy does. Raise
keepAliveTimeoutandheadersTimeoutabove the proxy’s.
What Render does not alert on
Render notifies you about failed deploys, services that become unhealthy and disks over 80 percent full. It has no notification for HTTP error rate, so a service that stays healthy while failing a share of its requests goes unnoticed.