com.azure.storage.blob.models.BlobStorageException: Status code 400, (empty body)
- 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
### 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?
```java
//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 blobs = blobContainerClient.listBlobsByHierarchy(location, options, Duration.ofSeconds(15));
// this fails ❌
PagedIterable blobs = blobContainerClient.listBlobsByHierarchy(location);
assertFalse(blobs.iterator().hasNext());
```
### Have you found a mitigation/solution?
```java
ListBlobsOptions options = new ListBlobsOptions().setDetails(new BlobListDetails().setRetrieveMetadata(true));
blobContainerClient.listBlobsByHierarchy(location, options, Duration.ofSeconds(15));
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.