Azurite icon indicating copy to clipboard operation
Azurite copied to clipboard

Blob batch delete not working on azurite

Open ftreede opened this issue 1 year ago • 2 comments

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(<connection string>) //
                .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

ftreede avatar Nov 28 '24 10:11 ftreede

Can confirm, I'm seeing the same error with the latest Azurite image in combination with batch sdk version 12.25.0.

reinseth avatar Jan 28 '25 12:01 reinseth

Hi @EmmaZhu Would you please help to look at the blob batch issue?

blueww avatar Feb 05 '25 06:02 blueww

Still running into the same error on Azurite 3.35.0 and Python SDK 12.26.0. The hack implemented on the SDK side for #1809 doesn't seem to help.

Ilya-Q avatar Oct 15 '25 16:10 Ilya-Q