I'm running a small code to upload file in a SharePoint 2016 document library and to change a metadata.
Sometimes (but really often) my code returns error "Error making HttpClient request in queryable [404] Not Found" with the message "Item does not exist. It may have been deleted by another user."
This is my code:
pnp.sp.web.getFolderByServerRelativeUrl("/sites/mysite/ConfigDL").files.add(fileOgg.name, fileOgg, true).then(function (data) {
var RelativeUrls="/sites/mysite/ConfigDL/"+fileOgg.name;
//Retrive Document which is uploaded. Start
pnp.sp.web.getFolderByServerRelativeUrl(RelativeUrls).getItem().then(item => {
//update start Below Call to Doc List will update the Row baseed on Item.ID
pnp.sp.web.lists.getByTitle("ConfigDL").items.getById(item.ID).update({
Number: ""+number+""
}).then(r => {
alert(file.name + " upload successfully!");
});//update end
}); //Retrive Doc Info End
}); //Upload Document End
I can't get why this error happens randomly and what's wrong with my code. Any suggestion?