Reputation: 111
My azure function reads zip file from a storage account and extract it to another storage account.
For large files it throws all details of the error:
System.AggregateException: One or more errors occurred. (One or more errors occurred. (Blob operation is not supported.)) --->
System.AggregateException: One or more errors occurred. (Blob operation is not supported.) --->
Microsoft.WindowsAzure.Storage.StorageException: Blob operation is not supported.
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.PutBlockAsync(String blockId, Stream blockData, String contentMD5, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, AggregatingProgressIncrementer progressIncrementer, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.FlushAsync(CancellationToken cancellationToken)
at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.CommitAsync()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.<Dispose>b__8_0() at Microsoft.WindowsAzure.Storage.Core.Util.CommonUtility.RunWithoutSynchronizationContext(Action actionToRun)
at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at System.IO.Stream.Dispose()
at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.UploadFromStreamAsyncHelper(Stream source, Nullable`1 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress`1 progressHandler, CancellationToken cancellationToken)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.UploadFromFileAsync(String path, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress`1 progressHandler, CancellationToken cancellationToken)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.UploadFromFileAsync(String path, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
at PipelineTriggers.PreprocessingFunctions.WaxTriggersFromBlob(CloudBlockBlob myBlob, String name, ILogger log, ExecutionContext context) in D:\a\1\s\Development\PipelineTriggers\PipelineTriggers\PreprocessingFunctions.cs:line 94---> (Inner Exception #0)
System.AggregateException: One or more errors occurred. (Blob operation is not supported.) ---> Microsoft.WindowsAzure.Storage.StorageException: Blob operation is not supported.
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.PutBlockAsync(String blockId, Stream blockData, String contentMD5, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, AggregatingProgressIncrementer progressIncrementer, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.FlushAsync(CancellationToken cancellationToken)
at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.CommitAsync() ---> (Inner Exception #0)
Microsoft.WindowsAzure.Storage.StorageException: Blob operation is not supported.
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.PutBlockAsync(String blockId, Stream blockData, String contentMD5, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, AggregatingProgressIncrementer progressIncrementer, CancellationToken cancellationToken)
Request Information
RequestID:b35c121a-c01e-005d-1c38-90d752000000
RequestDate:Mon, 21 Sep 2020 16:57:10 GMT
StatusMessage:Blob operation is not supported.
ErrorCode:BlobOperationNotSupported
ErrorMessage:Blob operation is not supported.
RequestId:b35c121a-c01e-005d-1c38-90d752000000
Time:2020-09-21T16:57:10.0072501Z <--- <---
Here is the code :
foreach (var file in zip.Entries)
{
log.LogInformation($"Processing file: {file.Name}");
CloudBlockBlob blockBlob = container.GetBlockBlobReference(targetFolderName + "/" + file.Name);
blockBlob.Properties.ContentType = "text/csv";
await blockBlob.UploadFromStreamAsync(file.Open());
}
What cause this isue, and how can I solve it?
Upvotes: 0
Views: 3819
Reputation: 3398
Since I don't know the size of your file, here are some suggestion for you.
There is a limitation when upload block blobs said in Microsoft docs:
Storage clients default to a 128 MiB maximum single blob upload, settable in the Azure Storage client library for .NET version 11 by using the SingleBlobUploadThresholdInBytes property of the BlobRequestOptions object. When a block blob upload is larger than the value in this property, storage clients break the file into blocks.
A block blob can include up to 50,000 blocks.
You can write a set of blocks using Put Blob to upload your file, there is also a limitation:
The maximum size for a block blob created via Put Blob is 256 MiB for version 2016-05-31 and later, and 64 MiB for older versions. If your blob is larger than 256 MiB for version 2016-05-31 and later, or 64 MiB for older versions, you must upload it as a set of blocks.
Upvotes: 1