Azure-docs: BlobClient UploadAsync throws 409 Blob exists, but docs state it overwrites

Created on 19 Dec 2019  Â·  4Comments  Â·  Source: MicrosoftDocs/azure-docs

In the guide for BlobClient, it states that UploadAsync: "creates the blob if it doesn't already exist, and overwrites it if it does."

However, when calling UploadAsync with an existing file name (even though both methods state the same), I get a 409 The specified blob already exists error.

Is it possible that this should read that it "overwrites any existing metadata on the blob" ?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 assigned-to-author blobsubsvc doc-enhancement storagsvc triaged

Most helpful comment

Okay, so after some investigation, it appears that you must use the overload with the second boolean parameter set to true (default is false) in order to utilise the behaviour described in the documentation.

Might be worth correcting the doc to say that you must pass this parameter to overwrite the blob.

All 4 comments

Okay, so after some investigation, it appears that you must use the overload with the second boolean parameter set to true (default is false) in order to utilise the behaviour described in the documentation.

Might be worth correcting the doc to say that you must pass this parameter to overwrite the blob.

@Reisclef Thanks for the feedback! I have assigned the issue to the content author to evaluate and update as appropriate.

@Reisclef thank you for the feedback. I've updated the code to use the overload you recommended.

Thanks!
~ _Mark_

please-close

Not sure if this is the right location, but the API documentation for UploadAsync is still incorrect.

The UploadAsync(String, CancellationToken) operation creates a new block blob or updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob.

See:
https://docs.microsoft.com/en-us/dotnet/api/azure.storage.blobs.blobclient.uploadasync?view=azure-dotnet#Azure_Storage_Blobs_BlobClient_UploadAsync_System_IO_Stream_System_Threading_CancellationToken_

I don't think this API is actually updating the blob, since when doing so I get the following response:

Status: 409 (The specified blob already exists.)
ErrorCode: BlobAlreadyExists

Not sure if this is also the case for the regular Upload method, but I would assume it is incorrect aswell.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Agazoth picture Agazoth  Â·  3Comments

jebeld17 picture jebeld17  Â·  3Comments

varma31 picture varma31  Â·  3Comments

mrdfuse picture mrdfuse  Â·  3Comments

JamesDLD picture JamesDLD  Â·  3Comments