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.

com.azure.storage.blob.models.BlobStorageException: Status code 400, (empty body)

See original GitHub issue

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

blob

Which version of the Azurite was used?

3.7.0 (mcr.microsoft.com/azure-storage/azurite:3.7.0) I also used azurite:latest.

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

DockerHub

What’s the Node.js version?

na (FROM node:10-alpine in Dockerfile)

What problem was encountered?

When using com.azure:azure-storage-blob:12.6.1 and using listBlobs an exception is thrown: com.azure.storage.blob.models.BlobStorageException: Status code 400, (empty body)

^ this is inconsistent with the production Azure blob storage service. This issue is documented here: https://github.com/Azure/azure-sdk-for-java/issues/6945. Azurite should have the same behaviour as the production service.

Steps to reproduce the issue?

//String connectionString = realConnectionString;
String connectionString = fakeConnectionString;
System.out.println("Using the Connection String: " + connectionString);

String containerName = "somecontainer";
StorageSharedKeyCredential credential = StorageSharedKeyCredential.fromConnectionString(connectionString);

BlobContainerClient blobContainerClient = new BlobContainerClientBuilder()
         .connectionString(connectionString)
         .containerName(containerName)
        .credential(credential)
        .buildClient();

// create the container if it doesn't already exist
if (!blobContainerClient.exists()) {
    blobContainerClient.create();
}

String location = "testing";

// As documented by https://github.com/Azure/azure-sdk-for-java/issues/6945
ListBlobsOptions options = new ListBlobsOptions().setDetails(new BlobListDetails().setRetrieveMetadata(true));

// this passes ✅
//PagedIterable<BlobItem> blobs = blobContainerClient.listBlobsByHierarchy(location, options, Duration.ofSeconds(15));
// this fails ❌
PagedIterable<BlobItem> blobs = blobContainerClient.listBlobsByHierarchy(location);
        assertFalse(blobs.iterator().hasNext());

Have you found a mitigation/solution?

ListBlobsOptions options = new ListBlobsOptions().setDetails(new BlobListDetails().setRetrieveMetadata(true));
blobContainerClient.listBlobsByHierarchy(location, options, Duration.ofSeconds(15));

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
XiaoningLiucommented, Jul 3, 2020

It’s another undocumented behavior for Azure Storage production, not an issue of Azurite.

1reaction
bluewwcommented, Jun 12, 2020

@snodnipper

Thanks for the info! I get the failure happens when “include=” don’t have any value. As I see, Java SDK has fixed the issue, and I don’t see other SDK (like .net) has this issue. So seems the issue is not blocking currently.

We will discuss how to fix it, and update when get a decision.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting error 400 bad request when accessing Azure blob ...
I am running in to the "400 bad request" error that many have posted about when accessing Azure blob storage. Most of the...
Read more >
Azure Blob Storage error codes - Microsoft Learn
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 >
com.azure.storage.blob.models.BlobStorageException
azure.storage.blob.models.BlobStorageException: Status code 404, (empty body) on deleting files in Azure connection.
Read more >
BlobStorageException (Azure SDK for Java Reference ... - NET
declaration: package: com.azure.storage.blob.models, ... is thrown whenever Azure Storage successfully returns an error code that is not 200-level.
Read more >
[NEXUS-31948] Attempting to create Azure blob store with an ...
BlobStorageException: Status code 404, (empty body)'; mapped from: com.azure.storage.blob.models.BlobStorageException: Status code 404, ...
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