Search code examples
microsoft-graph-apisharepoint-onlinemicrosoft-graph-sites

InternalServerError after Consecutive Uploads


I'm trying to upload multiple files to a client's SharePoint using separate calls to the following endpoint

https://graph.microsoft.com:443/v1.0/drives/{drive-id}/root:/{itemId}:/microsoft.graph.createUploadSession.

An average of fifty files upload successfully, but eventually I receive the following error.

Error = {
    Code: generalException
    Message: An unspecified error has occurred.
    Inner Exception: {
        Additional Data: {[
            {[request-id, 34068a5e-41ac-4009-814a-f085f7e03443]},   
            {[date, {1/23/2020 3:59:27 PM}]}
        ]}
    }
}

Below is the received response header

{
    request-id: 34068a5e-41ac-4009-814a-f085f7e03443
    client-request-id: 34068a5e-41ac-4009-814a-f085f7e03443
    x-ms-ags-diagnostic: {
        "ServerInfo":{
            "DataCenter":"South Central US", 
            "Slice":"SliceC", 
            "Ring":"4", 
            "ScaleUnit":"002", 
            "RoleInstance":"AGSFE_IN_5"
        }
    }
    Strict-Transport-Security: max-age=31536000
    Cache-Control: private
    Date: Thu, 23 Jan 2020 15:59:27 GMT
}

I don't think our application is being throttled since we're not receiving a 429 response. I also don't believe it is a file size issue as the files are under 4MBs


Solution

  • In the end, the issue was related to a space at the end of a folder name within our path.

    We were constructing paths based on user named entities and were failing to trim them before uploading to Sharepoint. Oddly, we were allowed to upload one file to the Sharepoint which seemed to trim the elements of the path accordingly, but the second file uploaded would always throw the above error.