Azure Storage Copy Blob From Url (REST API) error on x-ms-requires-sync header

44 Views Asked by At

I want to upload a large file (public accessable over the internet) to an Azure blob using the PUT REST API with the x-ms-copy-source header. The PUT uri includes a SAS token and I use these headers:

x-ms-version: 2023-11-03
x-ms-blob-type: BlockBlob
x-ms-copy-source: https://mypublicfile/filename.csv

That works fine. But the documentation states that also the x-ms-requires-sync:true headers should be added and is required. But when I add this, I get this error:

<?xml version="1.0" encoding="utf-8"?>
<Error>
    <Code>InvalidHeaderValue</Code>
    <Message>The value for one of the HTTP headers is not in the correct format.
RequestId:935f1ff5-a01e-0065-6f34-80e89b000000
Time:2024-03-27T10:51:11.7886167Z</Message>
    <HeaderName>x-ms-requires-sync</HeaderName>
    <HeaderValue>true</HeaderValue>
</Error>

Any idea what I am doing wrong?

Beside this, is there any size limit (beside the obvious max blob sizes stated here). Up to 5GiB seems to work fine, but large files give an error.

1

There are 1 best solutions below

5
Venkatesan On BEST ANSWER
<Message>The value for one of the HTTP headers is not in the correct format.</Message>
<HeaderName>x-ms-requires-sync</HeaderName>
<HeaderValue>true</HeaderValue> </Error> 

The above error indicates that the x-ms-requires-sync header is not required for copying blobs from a URL. This header is used to specify whether the copy operation should be synchronous.

Copy blob operations are asynchronous by default. Therefore, you can remove the x-ms-requires-sync header from your request.

Hence, I also tried without x-ms-requires-sync in my request, and it executed successfully.

Postman:

enter image description here

Portal:

enter image description here

Regarding your second question.the Maximum blob size via single write operation" is 5000MiB. If you need to upload a larger blob, you can break it up into smaller blocks or chunks and upload them in parallel.

You can use the Put block from url request to upload large files that will break blobs into chunks and upload the chunks using the request. You would then need to commit those chunks using Put Block List after you have uploaded all of them.

Reference:

How to upload a large file (~10GB) into Azure Blob Storage directly from Browser, using PUT with SaS Url? - Stack Overflow by Gaurav Mantri.