With version 4.6 I am seeing "unable to create worker" in the console.

1804
4
03-16-2018 12:39 PM
TonyAbo
New Contributor

Recently upgraded to API 4.6 from 4.4. When running from built JavaScript layer, I am getting the message "[esri.core.workers.JobProxy] Failed to create Worker. Fallback to execute module in main thread" in the console several times when displaying the map. This is followed by:

ErrorEvent {isTrusted: true, message: "Uncaught Error: Uncaught TypeError: Cannot read property 'addEventListener' of undefined", filename: "http://rhel7/pkgs/esri/core/workers/worker.js", lineno: 25, colno: 555, …}

When I set devtools to pause on exceptions, it appears to get the error while evaluating: " self.importScripts(n.loaderUrl)" in the messageHandler function of  worker.js. The event.data object has the type field "<configure>" when this happens.

Note that I am only seeing errors in the built version. When running from source files, there are no errors.

Any guidance to resolving this issue would be appreciated.

4 Replies
ReneRubalcava
Frequent Contributor

Do you happen to be running an ad-blocker? If you are and disable it, do you still get the same error?

If you're using AdBlock, we're currently trying to figure out which filter list is blocking the workers.

If that's the case, could you provide the filter list you are using?

0 Kudos
TonyAbo
New Contributor

No ad-blocker is in use.

0 Kudos
JonNordling1
New Contributor II

Not sure if this is related but I was getting the "unable to create worker" in my console also. I found the issue with a variable name "URL" If you use a variable name is "URL" (which i was using in my dojoConfig) you will get this error. Simple fix was to rename the variable, but im guessing this is just a bug to be fixed in a a future release.. I was using 4.7. Hope this helps someone.

dojo.js:249 [esri.core.workers] Failed to create Worker. Fallback to execute module in main thread TypeError: URL.createObjectURL is not a function

var URL = location.href.replace(/\/[^/]+$/, '');
var dojoConfig = {
async: true,
packages:[{
name:'js',
location: URL + '/js'
}],
callback: function() {
require(['js/main']);
}
}
AllanBeihl
New Contributor II

Bless you !

0 Kudos