0

I have two versions of an API I can toggle via a feature flag. (One that returns application/json and another that returns application/octet-stream)

When I enabled the feature flag to use the new application/octet-stream There seems to be a small subset of users for the API where they received failed to fetch. The users where the octet-stream API works and doesn't have the same browser versions and OS. The different users have same browser versions and operating system.

This is the request header I send for both API.

  "headers": {
    "accept": "*/*",
    "accept-language": "en-US,en;q=0.9",
    "authorization": "...",
    "content-type": "application/json",
    "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"", // They would be using Chrome and it might be v102
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "// I believe this would be Windows 10",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-site",
  },
  "referrer": "...",
  "referrerPolicy": "no-referrer-when-downgrade",
  "body": "...",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"

This is the error from the logs (its similar to errors where there's no connection but the server receives the request and the other APIs seem to be returning correctly based on the logs)

  "error": {
        "message": "Failed to fetch",
        "name": "TypeError",
        "stack": "TypeError: Failed to fetch\n (...the chunks it failed at)"
    },

Does anyone know what could be causing this issue? Am I missing an request or response header like maybe changing accept-encoding? or is it maybe a corporate firewall?

Kenneth Truong
  • 3,882
  • 3
  • 28
  • 47
  • Share the full error and the HTTP request and response that caused it – Evert Jul 02 '22 at 06:23
  • ah I just added more details – Kenneth Truong Jul 02 '22 at 13:36
  • Still need all the details. The error is an improvement but there's still parts of even the error itself missing. – Evert Jul 02 '22 at 23:46
  • Unfortunately that's all the details I can get back from this notorious `Failed to fetch` errors. Unless you had ideas on how to get more details from this error? I can add some more logging. Looking online it looks like this can come back when the user doesn't have internet connection etc but there's no details other than this. But I know that the user has an internet connection because the other APIs work fine. – Kenneth Truong Jul 03 '22 at 04:50
  • Yeah if you haven't reproduced it yourself yet, try to log more. There's just not a whole lot to work with here. I tried googling based on the partial error, but not much luck. Get the full request and response when this happens. – Evert Jul 03 '22 at 06:51
  • Yea I found out that to get the actual error I'll need to have the browser send it via https://developer.mozilla.org/en-US/docs/Web/HTTP/Network_Error_Logging which I will be looking into – Kenneth Truong Jul 08 '22 at 02:19

1 Answers1

0

I had the same problem. The main cause of this - free space on disk where Chrome catalog located. See details https://stackoverflow.com/questions/10988569/storage-limits-on-chrome-browser,