DEV Community

Nick Vahalik
Nick Vahalik

Posted on

Reasons why you can get Error 0 during an HTTP Request

One of the most frustrating things that can happen is you can start getting Unknown errors (Error status 0) on HTTP requests in your PWA/app.

Error 0 is a weird error since effectively what's happened is that the request has failed failed. Not just failed, but failed in a way that the system doesn't know how to handle. This can happen for a number of reasons, but this is my handy checklist for trying to figure things out:

  • CORS isn't set up properly. (check the browser logs, they will tell you this)
  • Preflight is failing. Is your server handling this properly? Is it returning an error?
  • The response is corrupt. Did you leave a debugging statement in there? Did something happen to cause HTML output when the browser is expecting JSON?
  • Did you exceed some sort of throttling? This can cause a problem, too.

Top comments (0)