[Azure Storage] Delete blobs in batch fails with 404 error even though blobs are present.
See original GitHub issueDescribe 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:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
@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.
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