Hello!
Our customer sometimes experiences error "Failed to load map" in ExB app. See the attached file. The application is created at ArcGIS Experience Builder Developer Edition v1.9 and deployed to an IIS. Following this advice I'd added "jimu-arcgis" dependency to all custom widgets, but it didn't help. It happens to all deployed applications, and we haven't been able to find a pattern to cause the error. It seems to happen randomly.
Here are the errors from DevTools:
CacheFirst.js?7526:84
Uncaught (in promise) no-response: The strategy could not generate a response for 'https://js.arcgis.com/4.24/init.js'. The underlying error is TypeError: Failed to fetch.
at CacheFirst._handle (webpack-internal:///./node_modules/workbox-strategies/CacheFirst.js:95:19)
at async CacheFirst._getResponse (webpack-internal:///./node_modules/workbox-strategies/Strategy.js:155:24)
_handle @ CacheFirst.js?7526:84
—
Load module error. TypeError: window.require is not a function
at (index):296:12
at new Promise (<anonymous>)
at SystemJS.constructor.instantiate ((index):295:11)
at init.js:1:27896
—
Create datasource error. dataSource_5 TypeError: Cannot read properties of undefined (reading 'setLocale')
at ye.<anonymous> (index.js:1:61009)
at Generator.next (<anonymous>)
at n (index.js:1:59653)
—
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'findOAuthInfo')
at ye.registOAuthInfo (index.js:1:63010)
at ye.<anonymous> (index.js:1:62699)
at Generator.next (<anonymous>)
at index.js:1:59851
at new Promise (<anonymous>)
at te (index.js:1:59596)
at ye.initToRegistOAuthForMainPortalAndAGOL (index.js:1:62536)
at ye.<anonymous> (index.js:1:60917)
at Generator.next (<anonymous>)
at n (index.js:1:59653)
at ye.initToRegistOAuthForMainPortalAndAGOL (index.js:1:62536)
at ye.<anonymous> (index.js:1:60917)
at Generator.next (<anonymous>)
at n (index.js:1:59653)
Any idea what could cause this error? Something in custom widget maybe?
Thanks, Matěj.
Was this ever resolved? I am receiving this error with several of my experiences as well. It leaves a very poor impression on our end customers when the map fails to load...
I was forced to develop a custom widget that detect fail of map load and refreshes the page when this happens. Maybe the bug has been fixed in a newer version, thought.
My employer wouldn't be happy if I shared the whole widget. Try to get inspired by this code, it should satisfy your requirements.
import { type JimuMapView, JimuMapViewComponent } from "jimu-arcgis";
import { React, type AllWidgetProps, JimuMapViewStatus } from "jimu-core";
export default function(props: AllWidgetProps<{}>) {
return <JimuMapViewComponent
useMapWidgetId={props.useMapWidgetIds?.[0]}
onActiveViewChange={onActiveViewChange}
/>;
}
function onActiveViewChange(newJimuMapView: JimuMapView) {
if (newJimuMapView.status === JimuMapViewStatus.Failed) {
window.location.reload();
}
}