Trying to save WebMap to esri fails. For testing, I'm just loading a plain base map and saving it. I get the error: Error TypeError: Cannot read property 'addItem' of null.
Code: (Using Javascript API v4.20)
// item automatically casts to a PortalItem instance by saveAs
var item = {
title: title.value
};
// Update properties of the WebMap related to the view.
// This should be called just before saving a webmap.
map.updateFrom(view).then(function () {
map.saveAs(item)
// Saved successfully
.then(function (item) {
// link to the newly-created web scene item
var itemPageUrl =
item.portal.url + "/home/item.html?id=" + item.id;
var link = '<a target="_blank" href="' + itemPageUrl +
'">' + title.value + "</a>";
statusMessage("Save WebMap",
"<br> Successfully saved as <i>" + link + "</i>"
);
})
// Save didn't work correctly
.catch(function (error) {
statusMessage("Save WebMap", "<br> Error " + error);
});
});