REST API(V3) sporadically returns 502

We sometimes get 502 errors with the message being “Server error”

This is the request being sent out.

    "method": "GET",
    "url": "[REDACTED]/[REDACTED]/branches?protected=true&per_page=1",
    "headers": {
      "accept": "application/vnd.github.application/vnd.github.drax+json-preview+json,application/vnd.github.application/vnd.github.luke-cage+json-preview+json",
      "user-agent": "octokit.js/16.25.1 Node.js/10.16.0 (Linux 4.9; x64)",
      "authorization": "token [REDACTED]"

We use the node.js module(octokit/rest) to make the requests. The errors are inconsistent and after we added retries it improved but not solved completely and we still get them sometimes.

We are a GitHub app.

We tried opening several tickets with the support but didn’t get any reply/help.

Couldn’t find anything similar on the forums other than another issue about the same error but with the graphql api.

Would appreciate any help the community can provide, this impacts our clients and we are out of ideas :confused:


Wanted to post an update in case anyone else encounters the same issue. GitHub support answered us and the reason for our 502 was a timeout on an API call(branch protection settings in our case).

There’s a 10s timeout on API calls and apparently, when a request times out you get a 502 :confused: