question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Azure Storage] Delete blobs in batch fails with 404 error even though blobs are present.

See original GitHub issue

Describe the bug When trying to delete blobs in batch, the operation fails with 404 error even though the blobs are present in the container. The issue is occuring because of DeleteSnapshotsOption.IncludeSnapshots and the blobs do not have any snapshots.

Expected behavior Blobs should be deleted.

Actual behavior (include Exception or Stack Trace) Blobs are not deleted and instead 404 error is thrown.

To Reproduce

Please see sample code:

var _credential = new DefaultAzureCredential();
BlobServiceClient client = new(new Uri("https://myaccount.blob.core.windows.net"), _credential);
BlobBatchClient batchClient = new(client);
List<Uri> blobsToDelete = new List<Uri>()
{
    new Uri("https://myaccount.blob.core.windows.net/container/blob1.txt"),
    new Uri("https://myaccount.blob.core.windows.net/container/blob2.txt")
}
await batchClient.DeleteBlobsAsync(blobsToDelete, DeleteSnapshotsOption.IncludeSnapshots)//throws 404 error

The issue is occuring because of DeleteSnapshotsOption.IncludeSnapshots and the blobs do not have any snapshots. If I use DeleteSnapshotsOption.None, then the blobs are deleted properly.

Please see this Stack Overflow thread as well: https://stackoverflow.com/questions/68031928/azure-blobbatchclient-deleteblobsasync-always-return-404-blob-not-found.

Please note that doing similar operation with Node SDK works just fine.

Environment:

  • Name and version of the Library package used: Azure.Storage.Blobs 12.9.1/Azure.Storage.Blobs.Batch 12.6.0
  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects):
.NET SDK (reflecting any global.json):
Version:   5.0.203
Commit:    383637d63f

Runtime Environment:
OS Name:     Mac OS X
OS Version:  11.0
OS Platform: Darwin
RID:         osx.11.0-x64
Base Path:   /usr/local/share/dotnet/sdk/5.0.203/

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gmantricommented, Sep 21, 2021

@seanmcc-msft - Thanks! I only looked at the change log for Azure.Storage.Blobs. I should have looked wider 😃. Closing the issue. Thanks for all your help.

1reaction
seanmcc-msftcommented, Sep 21, 2021

https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Blobs.Batch/CHANGELOG.md#1270-2021-09-08

I believe we fixed the bug associated with this issue in Azure.Storage.Blobs v12.7

-Sean

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure BlobClient DeleteIfExistsAsync error: 404 The ...
There is nothing wrong with your code. The Azure SDK just tries to delete the blob. If an exception occurs because it does...
Read more >
Azure Blob Storage error codes
Error code HTTP status code User message BlobAlreadyExists Conflict (409) The specified blob already exists. BlobNotFound Not Found (404) The specified blob does not exist. ContainerAlreadyExists...
Read more >
Delete Blob (REST API) - Azure Storage
The Delete Blob operation marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection.
Read more >
How to solve 404 while working with azure.storage.fileshare?
This looks like a request made to retrieve a file from an Azure File Storage service, and the response indicates that the file...
Read more >
Delete and restore a blob container with .NET - Azure
Learn how to delete and restore a blob container in your Azure ... or the blobs it contains will fail with HTTP error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found