Azurite: 3.30.0 - StartCopyFromUriAsync - 500 Error
Which service(blob, file, queue, table) does this issue concern?
blob
Which version of the Azurite was used?
3.30.0
Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)
docker
What’s the Node.js version?
N/A
What problem was encountered?
Error Message:
Azure.RequestFailedException : Service request failed.
Status: 500 (Internal Server Error)
Headers:
Server: Azurite-Blob/3.30.0
Date: Fri, 26 Apr 2024 10:04:24 GMT
Connection: keep-alive
Keep-Alive: REDACTED
Content-Length: 0
Stack Trace:
at Azure.Storage.Blobs.BlobRestClient.StartCopyFromURLAsync(String copySource, Nullable`1 timeout, IDictionary`2 metadata, Nullable`1 tier, Nullable`1 rehydratePriority, Nullable`1 sourceIfModifiedSince, Nullable`1 sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, Nullable`1 ifModifiedSince, Nullable`1 ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String leaseId, String blobTagsString, Nullable`1 sealBlob, Nullable`1 immutabilityPolicyExpiry, Nullable`1 immutabilityPolicyMode, Nullable`1 legalHold, CancellationToken cancellationToken)
at Azure.Storage.Blobs.Specialized.BlobBaseClient.StartCopyFromUriInternal(Uri source, IDictionary`2 metadata, IDictionary`2 tags, Nullable`1 accessTier, BlobRequestConditions sourceConditions, BlobRequestConditions destinationConditions, Nullable`1 rehydratePriority, Nullable`1 sealBlob, BlobImmutabilityPolicy destinationImmutabilityPolicy, Nullable`1 legalHold, Boolean async, CancellationToken cancellationToken)
at Azure.Storage.Blobs.Specialized.BlobBaseClient.StartCopyFromUriAsync(Uri source, BlobCopyFromUriOptions options, CancellationToken cancellationToken)
Steps to reproduce the issue?
Our test creates two containers, uploads an image to one container then tries to copy by url with sas token.
var blobService = new BlobServiceClient(connectionString);
var a = blobService.GetBlobContainerClient("container-a");
await a.CreateIfNotExistsAsync();
var b = blobService.GetBlobContainerClient("container-b");
await b.CreateIfNotExistsAsync();
var blob = a.GetBlobClient("Test1/Test2/Example.png");
const string base64Image = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAARUlEQVR4nGJxk6tkIAUwFcSSpp4k1WSAUQtGLRi1YNSCUQuoAViqbmiTpOE2vwRJ6od+EI1aMGrBqAWjFowICwABAAD//8sqBHDcliZLAAAAAElFTkSuQmCC";
using (var ms = new MemoryStream(Convert.FromBase64String(base64Image)))
{
await blob.UploadAsync(ms, new BlobHttpHeaders
{
ContentType = "image/png"
});
}
var sasCredential = new StorageSharedKeyCredential("AccountNameFromConnectionString", "AccountKeyFromConnectionString");
var blockBlob = new BlockBlobClient(blob.Uri, sasCredential);
var policy = new BlobSasBuilder(BlobSasPermissions.Read, DateTimeOffset.UtcNow.AddMinutes(5))
{
StartsOn = DateTimeOffset.UtcNow
};
var sasUri = blockBlob.GenerateSasUri(policy);
var bBlobClient = b.GetBlobClient("Test3/Example.png");
var blobProperties = await blockBlob.GetPropertiesAsync();
var options = new BlobCopyFromUriOptions
{
DestinationConditions = new BlobRequestConditions { IfModifiedSince = null }
};
var copyOperation = await bBlobClient.StartCopyFromUriAsync(sasUri, options); // <--- Error here
await copyOperation.WaitForCompletionAsync();
Have you found a mitigation/solution?
Downgrade to 3.29.0
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 26 (12 by maintainers)
Hi @blueww
When I call StartCopyFromUriAsync, an exception is thrown.
Here is the code:
Exception:
Azurite Debug Logs:
What is the status of this issue?
I’m having the same problem.
Using Azure.Storage.Blobs 12.24.1 and Azurite 3.34.0 (docker).