Azure / Azure/Azurite

Blob batch delete not working on azurite

Open
#2,509 4 comments 0 reactions 1 assignee Claimed by @EmmaZhu View on GitHub
Dominant language
TypeScript
Stars
2.3k
Forks
393
Avg merge
1d 20h
Merged PRs (30d)
36

Description

**Which service(blob, file, queue, table) does this issue concern?**

Blob Storage

**Which version of the Azurite was used?**

3.33.0

**Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)**

NPM

**What's the Node.js version?**

20.13.1

**What problem was encountered?**

Trying to perform a batch delete against azurite does not work, raising this error:

```
com.azure.storage.blob.models.BlobStorageException: InvalidInput
at com.azure.storage.blob.batch.BlobBatchHelper.lambda$mapBatchResponse$0(BlobBatchHelper.java:99)
```

Running the same code against a Azure Blob proper works.

Seems to be the same issue as #2309 .

**Steps to reproduce**

Sample code:
```
import com.azure.core.util.BinaryData;
import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.BlobContainerClientBuilder;
import com.azure.storage.blob.batch.BlobBatch;
import com.azure.storage.blob.batch.BlobBatchClient;
import com.azure.storage.blob.batch.BlobBatchClientBuilder;

public class AzuriteBatchDeleteTest {
public static void main(String[] args) {
BlobContainerClient client = new BlobContainerClientBuilder() //
.connectionString() //
.containerName("test") //
.buildClient();

// make sure the container exists
if (!client.exists()) {
client.create();
}
System.out.println("Container created");

client.getBlobClient("test1").upload(BinaryData.fromString("test1"));
client.getBlobClient("test2").upload(BinaryData.fromString("test2"));

System.out.println("Blobs created");

// delete all blobs
BlobBatchClient blobBatchClient = new BlobBatchClientBuilder(client)
.buildClient();

BlobBatch batch = blobBatchClient.getBlobBatch();
batch.deleteBlob(client.getBlobContainerName(), "test1");
batch.deleteBlob(client.getBlobContainerName(), "test2");
blobBatchClient.submitBatch(batch);

System.out.println("Blobs deleted");
}
}
```

Azurite debug.log output: [debug.log](https://github.com/user-attachments/files/17946601/debug.log)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.