I am attempting a very basic script that loads a Portal WebMap using the Esri JS API. Here is the error message I am getting:
EDIT: For some reason it seems to be directing towards www.arcgis.com instead of my portal...
(index):146 [esri.WebMap] #load() Failed to load web map
l
details:
error: l
details:
getHeader: V=>ya.headers.get(V)
httpStatus: 400
messageCode: "CONT_0001"
messages: []
raw: {code: 400, messageCode: 'CONT_0001', message: 'Item does not exist or is inaccessible.', details: Array(0)}
requestOptions: {authMode: 'auto', body: null, cacheBust: false, method: 'auto', query: {…}, …}
ssl: false
subCode: undefined
url: "https://www.arcgis.com/sharing/rest/content/items/c1127b4c1e3e4ab9bd3005192f6e6731"
[[Prototype]]: Object
message: "Item does not exist or is inaccessible."
name: "request:server"
[[Prototype]]: c
[[Prototype]]: Object
message: "Failed to load portal item"
name: "webmap:load-portal-item"
[[Prototype]]: c
Here is my JS script:
require(["esri/config","esri/views/MapView", "esri/WebMap"],
(esriConfig, MapView, WebMap) => {
var esriConfig = {
portalUrl: "https://domain/portal/home/",
};
const webmap = new WebMap({
portalItem: {
// autocasts as new PortalItem()
id: "c1127b4c1e3e4ab9bd3005192f6e6731"
}
});
const view = new MapView({
map: webmap,
container: "viewDiv"
});
});
Here is my HTML script:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Testing</title>
<style>
#viewDiv {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
</style>
<link
rel="stylesheet"
href="https://js.arcgis.com/4.24/esri/themes/dark/main.css"
/>
</head>
<body>
<div id="viewDiv"></div>
<script src="https://js.arcgis.com/4.24/"></script>
<script src="js/test_main.js"></script>
</body>
</html>