Randomly get error from https://js.arcgis.com/4.12/

359
3
09-26-2019 04:22 AM
EemeliP
New Contributor II

I use ArcGIS JSAPI directly from js.arcgis.com. I more or less randomly get following error when trying to load a map into a MapView from portal or when creating a map from scratch. Am I missing some configuration or something like that? Any ideas? Maybe some availability issue (for me it doesn't look like one) as it works often OK after I load the same map after the error.

The JS code runs in IE, by the way. There is no other option as IE is in this case embedded into a native desktop application and changing it is not an option. However, it doesn't look like browser issue either...

Should I after all use local copy of the API? If so are there any instructions how to do that?

Thanks!

Exception was thrown at line 461, column 236 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'httpsDomains' of undefined or null reference
Exception was thrown at line 188, column 29 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'httpsDomains' of undefined or null reference
Exception was thrown at line 188, column 120 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'httpsDomains' of undefined or null reference
Exception was thrown at line 188, column 29 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'httpsDomains' of undefined or null reference
Exception was thrown at line 188, column 120 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'httpsDomains' of undefined or null reference
Exception was thrown at line 188, column 29 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'httpsDomains' of undefined or null reference
Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference
Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference
Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference
Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference
Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference
Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference
Exception was thrown at line 1503, column 211 in https://js.arcgis.com/4.12/
0x800a138f - JavaScript runtime error: Unable to get property 'loaderUrl' of undefined or null reference

0 Kudos
3 Replies
Noah-Sager
Esri Regular Contributor

Hi Eemeli,

Sorry to hear about the trouble. Could you please provide a reproducible test case on something like CodePen so we can test from our side?

I would also recommend testing the app in different web browsers to see if the issues occur there as well. Especially with IE. That way we can determine if the API is the issue, or if the native desktop application is causing some conflict.

Here are some additional resources:

Different ways to work with the JS API

Get the API | ArcGIS API for JavaScript 4.12 

Test app (webmap from Portal)

Load a basic WebMap - 4.12 

0 Kudos
EemeliP
New Contributor II

I probably was able to make this work. 

I programmatically changed the esriConfig portalUrl to point our own portal. However it seems to be required to reset the portalUrl back to default in order to load a baseMap. At least it seems to work now when I reset the portalUrl before building the map from scratch.

esriConfig.portalUrl = "https://www.arcgis.com";
0 Kudos
EemeliP
New Contributor II

Well, this wasn't the fix after all.

It just happened to work for a while after I changed that. However after some more investigation it seems that exception comes from the workers when creating a Map. For the first load of the map the workers in esriConfig are not available and when the JSAPI tries to read e.g. portalUrl from that undefined object it throws an error.

Is there a way to set like "default" workers? I'm not familiar with the workers framework, I understand the point it being there but is it something that is related to a map and it's data or are the workers loaded from portal or always set from the code? The error may be related to the javascript engine I need to use, but can I somehow use some default workers so that would not get that 'undefined' exception?

The way I load the map doesn't really differ from any Esri example, like this one:

https://developers.arcgis.com/javascript/latest/sample-code/intro-mapview/index.html

Edit:

New

API documentation (https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#workers) says:

"Modify the configuration to specify locations of packages to be loaded with the workers framework or to define a feature detection."

How can I determine the "locations"?

0 Kudos