403 error with PUT op to Azure Blob with file size > 256mb

Frederick Wong 96 Reputation points
2021-08-31T07:09:42.337+00:00

Hi,

My app uploads files to the blob storage with various file sizes. The webapp is built using react with nodejs and utilizes the "@azure/storage-blob" library for uploading files (the BlockBlobClient.uploadData API). The web client sends request to the server to generate a SAS token before calling the uploadData API, and everything went fine with files smaller than 256mb.

However, the blob storage returns 403 error (This request is not authorized to perform this operation using this permission.) whenever I try to upload files larger than 256mb. I noticed that the url generated by the uploadData API has two extra params (comp=block and blockid=<some id>) with files larger than 256mb. The request and response header both have x-ms-version 2020-08-04 (see attached image). Should it allow a single write operation of up to 5000mb in data size? Why the 256mb limit?

Can anyone help me to fix this issue or any link to an example that will perform a file upload using Javascript API for large files?

Thanks so much. Any help is appreciated!

127749-cleanshot-2021-08-31-at-000051.png

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,449 questions
0 comments No comments
{count} votes

Accepted answer
  1. Frederick Wong 96 Reputation points
    2021-08-31T19:18:22.5+00:00

    Thanks @deherman-MSFT for the reply and links to the sample code. I really appreciate it.

    After experimenting with several SAS token creation methods, it turns out I need an extra "write" permission in addition to the "create" permission when I was creating the SAS token for the client to upload to the blob storage (only for stageBlock uploads). The change in permission list (from "c" to "cw" when calling BlobSASPermissions.parse() function) made the whole thing works for uploading both small and large files. All sample code use full permission when creating the token ("rwcadl") which does not really help in understanding how to use each permission individually, and it wasnt documented in the API doc as well.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. deherman-MSFT 33,701 Reputation points Microsoft Employee
    2021-08-31T17:28:10.027+00:00

    @Frederick Wong
    When using uploadData with a size greater than 256MB this method will call stageBlock to upload blocks, and finally call commitBlockList to commit the block list. Which is why you are seeing comp=block and blockid=. See the sample code here for an example of using uploadData. You might also find this GitHub issue helpful as it is somewhat related.

    Hope this helps. Let us know if you are still facing issues or need further assistance and we will do our best to assist.

    -------------------------------

    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments