I am using a webmap for one of my website. The problem is, sometimes the map is loading fne but sometimes the map failes to load leaving a console error
[esri.WebMap] #load() Failed to load web map
require(["esri/WebMap", "esri/views/MapView", "esri/widgets/Search", "esri/widgets/Zoom", "esri/widgets/Locate", "esri/popup/content/ImageMediaInfo", "esri/config", "esri/portal/Portal"], function (WebMap, MapView, Search, Zoom, Locate, ImageMediaInfo, esriConfig, Portal) {
esriConfig.portalUrl = "https://test.org/portal";
webmap = new WebMap({
portalItem: {
id: "*********",
},
});
var view = new MapView({
map: webmap,
container: "viewDiv",
center: [-95.9406, 41.26],
zoom: 13,
basemap: "topo",
constraints: {
minZoom: 12,
},
});
// webmap.loadStatus
view.when(function () {
webmap
.load()
.then(function () {
return webmap.basemap.load();
})
.then(function () {
let allLayers = webmap.allLayers;
var promises = allLayers.map(function (layer) {
return layer.load();
});
return Promise.all(promises.toArray());
})
.then(function (layers) {
webmap.removeAll();
})
.catch(function (error) {
// the webmap or portal failed to load
console.log("The resource failed to load: ", error);
});
});
});
Sometimes the map is not working because poor gis server?
These are the other console errors i get when I run the script.
WebGL warning: drawArraysInstanced: Tex image TEXTURE_2D level 0 is incurring lazy initialization.
w {name: 'worker:port-closed', details: {…}, message: "Cannot call invoke('setUpdating'), port is closed"}
Object { name: "AbortError", details: undefined, message: "Aborted" }
"Cannot call invoke('eventLog.onEvent'), port is closed"
"Worker closing, aborting job calling 'updateSubscriptions'"
f {name: 'AbortError', details: undefined, message: "Worker closing, aborting job calling 'updateSubscriptions'"}
#load() Failed to load basemap (title: 'Community Map', id: '18e1c54bd14-basemap-3') TypeError: K is not a function
net::ERR_NAME_NOT_RESOLVED