Search code examples
javascriptweb-worker

What's causing this error when running a web worker?


First time using web workers and I get this error when I try to run it.

First I get a very generic error event sent to my worker.onerror handler. It does not have the message property, the only information is the property type which says error.

Looking at the network tab in dev tools, the request for the worker script looks like it succeeds but it only has provisional response headers and no content to preview.

Preview has:

failed to load response data: connection is closed, can't dispatch pending call to Network.getResponseBody


Solution

  • This caused me to waste about an hour searching for web worker errors. Anyway it turns out that you can get this error if you have a syntax error in your Javascript. At least that is what got me.