Closed avivunitq closed 4 months ago
@avivunitq
The incoming request Uri missing the storage account name: RequestURL=http://localhost/test-container?restype=container
If you use localhost, the Uri should look like RequestURL=http://localhost/devstoreaccount1/test-container?restype=container
You can find more details in https://github.com/Azure/Azurite?tab=readme-ov-file#endpoint--connection-url
@avivunitq
The incoming request Uri missing the storage account name:
RequestURL=http://localhost/test-container?restype=container
If you use localhost, the Uri should look likeRequestURL=http://localhost/devstoreaccount1/test-container?restype=container
You can find more details in https://github.com/Azure/Azurite?tab=readme-ov-file#endpoint--connection-url
I tried this as well, but then I got an 403 authentication error. But really shouldn't it work as stated? The account key, endpoint, and name should configure all of that behind the scenes, shouldn't it?
Ah, it worked! With REST it wasn't working, but changing the config did the trick. I changed the configured endpoint from this:
// spring cloud azure config
registry.add(
"spring.cloud.azure.storage.blob.endpoint",
() -> String.format("http://localhost:%s", azureBlobStorageContainer.getFirstMappedPort())
);
to this:
// spring cloud azure config
registry.add(
"spring.cloud.azure.storage.blob.endpoint",
() -> String.format("http://localhost:%s/devstoreaccount1/", azureBlobStorageContainer.getFirstMappedPort())
);
@avivunitq
Good to know your scenario works!
BTW, you can find the sample connecting string for Azurite in https://github.com/Azure/Azurite?tab=readme-ov-file#https-connection-strings Please note, the account name should be included in endpoint like : BlobEndpoint=https://127.0.0.1:10000/devstoreaccount1
I will close this issue. Feel free to contact us again if you need any further assistance.
Which service(blob, file, queue, table) does this issue concern?
blob
Which version of the Azurite was used?
3.29.0
Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)
DockerHub (through TestContainers GenericContainer)
What's the Node.js version?
whatever is included with the dockerfile
What problem was encountered?
I have set up access to Azure Blob Storage in Java 21 using Spring Cloud Azure 5.9.1. See here: https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/resource-handling
Everything is working as expected. I am now trying to integration test my code. Unfortunately, Azure does not have an easy way to set up a container with Testcontainers, so I set one up with
However, now when my code accesses the blob storage resource, it encounters an error.
Looking in the debug log, I see this error:
when I try to replicate this request using curl, I receive the same error.
I am using the following spring cloud azure blob storage configuration parameters, including the default dev storage account credentials. I followed the instructions here and added a connection string as well: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json&bc=%2Fazure%2Fstorage%2Fblobs%2Fbreadcrumb%2Ftoc.json&tabs=visual-studio%2Cblob-storage#connection-strings
I have not been able to successfully make any calls to the Azurite container--it seems they all return 400.
Steps to reproduce the issue?
Launch Azurite with Testcontainers. Try to connect with Spring Cloud Azure, or directly through a cURL request to the REST API.
If possible, please provide the debug log using the -d parameter, replacing \<pathtodebuglog> with an appropriate path for your OS, or review the instructions for docker containers:
Please be sure to remove any PII or sensitive information before sharing!
The debug log will log raw request headers and bodies, so that we can replay these against Azurite using REST and create tests to validate resolution.
Have you found a mitigation/solution?
No.