502 Bad Gateway error: routing infra can't connect to instance

Hey everyone, I’ve been having an issue with Render for weeks now, where once every 4 - 6 hours, a request to my web service (running a node.js express app) would get a 502 Bad Gateway response. The error is always this:

<main class="text-primary">
  <div class="request-id">
    Request ID: 9178d715741584bb-PDX
  </div>
  <div>
    This service is currently unavailable. Please try again in a few minutes.
  </div>
  <div>
    If you are the site owner, refer to 
    <a href="https://render.com/docs/troubleshooting-deploys#502-bad-gateway">
      Render's documentation
    </a>
    for troubleshooting.
  </div>
</main>
  1. After speaking with support, they mentioned the routing infra was unable to connect to my instance.

  2. The problem is very transient. Requests before and after are all successful

  3. It’s not reaching my express app as I have a middleware set up directly at the entry point to log the request, and I’ve not seen it come through.

I was told to set up a retry mechanism, but I’m not sure how to do that since I’m not even able to handle the request.

Anyone faced this problem before or have advice on how to deal with it?

1 Like

We are having similar issue (502 responses on Node.js app) that started all of the sudden on 2025-04-27.

Web service was running for more that 14 days without a problem.

If you find out the cause, let me know.

By the way: There is a section in render docs dedicated to this specific status code: Troubleshooting Your Deploy – Render Docs

I suspect that this issue might be related specific number of requests (over 40 per minute)

Please check your dashboard Metrics (Last 7 days/ Last 2 days). Maybe you will notice responses with 50x status codes when number of requests goes above this number.

I’ve set the server.keepAliveTimeout value as defined in docs - but that didn’t help.
I’ll set the server.headersTimeout when issue come up again