I'm receiving an error when providing an API Key using the JS SDK version 4.27. Same behavior for 4.25. This had previously been working:
loadModules([
'esri/config',
'esri/Map',
'esri/views/MapView',
]).then(([esriConfig, Map, MapView]) => {
esriConfig.apiKey = 'xxxxx';
const map = new Map({
basemap: 'topo-vector',
});
const view = new MapView({
viewDiv: 'test',
map: map
});
});
Obviously, substituting our actual API key for 'xxxxx'. This is hitting the following URL:
Without providing an API key, it works.
This had been working previously, as my developer account has historical usage. I've also tested a different API key and receive the same error. Structurally there's not much else going on in the code, and it's the same approach mentioned by official documentation: https://developers.arcgis.com/javascript/latest/tutorials/display-a-map/
Solved! Go to Solution.
@roberth does your API work when you try to use it in the tutorial's solution? https://developers.arcgis.com/javascript/latest/tutorials/display-a-map/
Wondering if this is specific to your application. Also, was there a specific version of the JavaScript Maps SDK where this stopped working for you since you mentioned this had been working previously?
@roberth does your API work when you try to use it in the tutorial's solution? https://developers.arcgis.com/javascript/latest/tutorials/display-a-map/
Wondering if this is specific to your application. Also, was there a specific version of the JavaScript Maps SDK where this stopped working for you since you mentioned this had been working previously?
Lo and behold it works now. I think it was just a temporary service disruption.
Glad to hear it works now! That is possible it could have been a service issue.
I am using apiKey and also app token to identify my app in my angular arcgis application.
but when i am loading a image layer https://env1.arcgis.com/arcgis/rest/services/Sentinel2_10m_LandCover/ImageServer
the key/token is causing the imagelayer can not be loaded.
and if i delete the apikey/token, i got a arcgis online login popup window, i can loaded this image layer after the user/pass is filled in the popup.
how to solve this problem? how to avoid the arcgis online login popup and load this imagelayer?
can i use usersession to achieve this?
That's very strange. It sounds like something happened to the API Key. I would try making a new one and testing it out. The workflow still works (I just checked). But I would also recommend not using an API Key in the app if it's not needed.