-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BlobUpload throws "The specifed resource name contains invalid characters" with Azure.Storage.Blobs #839
Comments
Wanted to confirm I am also seeing this issue when accessing the Emulator Blob Containers in Azure Storage Explorer v1.19.1. |
Would you please attach the Azurite debug log for the failure, so we can see the details and investigate it? From the test code, it seems you will first create a container with name "foo", then upload a blob with name "test.txt" into it. And I have tried to run the test case with new SDK on Azurite 3.13.1, and it work well, I can't repro the failure. |
The same test case works in old sdk and doesn't in the new sdk. I've was able to reproduce the bug with Azurite 3.13.1 and new sdk (12.9.1). Debug log:
|
The failed upload Blob request Uri in the debug log doesn't contain the container name "foo": From the Sample code test you have shared, as the Blobclient is created from container client Would you please add the container name to the blob Uri in you test, and see if it works? |
Here is a short reproducer using the official azure-storage-blob client; from azure.storage.blob import BlobServiceClient
CONNECTION_STRING = (
"DefaultEndpointsProtocol=http;"
"AccountName=devstoreaccount1;"
"AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSR"
"Z6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;"
"BlobEndpoint=http://127.0.0.1:32780/devstoreaccount1;"
)
blob_service_client = BlobServiceClient.from_connection_string(CONNECTION_STRING)
print(list(blob_service_client.list_containers())) The azurite instance is started through docker |
The docker logs show only this when I execute the script above;
|
It seems like a regression caused in 3.13, since the code above works perfectly fine with azurite 3.12. |
@blueww Sorry for the delay. Here is the debug log from Azurite when I attempt to list the containers in the emulator account via Azure Storage Explorer v1.19.1.
|
Would you please confirm, do you use Azurite 3.13.0 or 3.13.1? @isidentical |
Same error. |
Would you please confirm you are using 3.13.1. |
The last release I can see is 3.13.0, https://github.com/Azure/Azurite/releases |
The latest release is 3.13.1 , see https://github.com/Azure/Azurite/blob/master/README.md We still not tag it (so latest tag is still 3.13.0), but 3.13.1 has already released in all channels (npm, docker, VS Code extension). |
Yes, 3.13.1 seem to work with docker. |
I can also confirm that updating the docker image to v3.13.1 resolved the issue for me with Azure Storage Explorer. |
@moraleslevi, @isidentical |
Would you please help to update if you still see the error after add container name in the Uri when put blob? (like the Sample code test do) |
I will close the issue as not hear from you for a long time. |
@blueww This still reproduces even today.
Hope this helps someone else |
From the debug log picture in your above comment, we can see the issue is caused by the request send from you client to Azurite is not correct, it missed container name in the Uri. This should be a client issue. It looks Client code/sdk has come issue that send request with wrong uri which missed container name. |
In Squadron we are using Azurite to spin up a docker container that can be easily used in integration tests.
Recently I discovered, after trying to Migrate from Microsoft.Azure.Storage.Blob to Azure.Storage.Blobs, that BlobClient.UploadAsync() returns every time "The specified resource name contains invalid characters" when I try to use the BlobContainerClient.UploadAsync().
Version of Azure.Storage.Blobs is 12.9.0. The resource Uri is: http://localhost:49205/devstoreaccount1/foo so it doesn't have any invalid character.
Sample code test. Name of the failing test: BlobClient_UploadFile_ContentMatch.
The same code works against Azure Storage and with the old library.
Exception message:
` Message:
Azure.RequestFailedException : The specifed resource name contains invalid characters.
RequestId:75c2151b-c75d-4142-bb6c-33f755c736f3
Time:2021-06-18T10:43:31.100Z
Status: 400 (The specifed resource name contains invalid characters.)
ErrorCode: InvalidResourceName
Stack Trace:
BlockBlobRestClient.UploadAsync(Int64 contentLength, Stream body, Nullable
1 timeout, Byte[] transactionalContentMD5, String blobContentType, String blobContentEncoding, String blobContentLanguage, Byte[] blobContentMD5, String blobCacheControl, IDictionary
2 metadata, String leaseId, String blobContentDisposition, String encryptionKey, String encryptionKeySha256, Nullable1 encryptionAlgorithm, String encryptionScope, Nullable
1 tier, Nullable1 ifModifiedSince, Nullable
1 ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String blobTagsString, Nullable1 immutabilityPolicyExpiry, Nullable
1 immutabilityPolicyMode, Nullable1 legalHold, CancellationToken cancellationToken) BlockBlobClient.UploadInternal(Stream content, BlobHttpHeaders blobHttpHeaders, IDictionary
2 metadata, IDictionary2 tags, BlobRequestConditions conditions, Nullable
1 accessTier, IProgress1 progressHandler, String operationName, Boolean async, CancellationToken cancellationToken) <<GetPartitionedUploaderBehaviors>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- PartitionedUploader
2.UploadInternal(Stream content, TServiceSpecificArgs args, IProgress1 progressHandler, Boolean async, CancellationToken cancellationToken) BlobClient.StagedUploadInternal(Stream content, BlobUploadOptions options, Boolean async, CancellationToken cancellationToken) AzureStorageBlobResourceTests.BlobClient_UploadFile_ContentMatch() line 55 --- End of stack trace from previous location where exception was thrown ---
The text was updated successfully, but these errors were encountered: