TransferManager.DownloadAsync: blob type BlockBlob is not supported
See original GitHub issueWhich service(blob, file) does this issue concern?
BlockBlob
Which version of the SDK was used?
Microsoft.Azure.Storage.DataMovement 1.0.0 Microsoft.Azure.Storage.Blob 10.0.3 Microsoft Azure Storage Emulator 5.9.0.0
On which platform were you using? (.Net Framework version or .Net Core version, and OS version)
.NET Core 2.1 on Windows 10
How can the problem be reproduced? It’d be better if the code caused the problem can be shared.
Trying to download a BlockBlob content to a MemoryStream
via TransferManager.DownloadAsync
:
var blobStorageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true");
var blobClient = blobStorageAccount.CreateCloudBlobClient();
_blobContainer = blobClient.GetContainerReference("dev");
// using GetBlobBlockReference instead works
var blob = _blobContainer.GetBlobReference("test.jpg");
if (!await blob.ExistsAsync())
return;
var ms = new MemoryStream();
await TransferManager.DownloadAsync(blob, ms);
What problem was encountered?
DownloadAsync
throws an exception saying that blob type BlockBlob is not supported:
InvalidOperationException: The given blob type BlockBlob is not supported.
Microsoft.Azure.Storage.DataMovement.TransferControllers.SyncTransferController.GetReader(TransferLocation sourceLocation) in SyncTransferController.cs
Microsoft.Azure.Storage.DataMovement.TransferControllers.SyncTransferController..ctor(TransferScheduler transferScheduler, TransferJob transferJob, CancellationToken userCancellationToken) in SyncTransferController.cs
Microsoft.Azure.Storage.DataMovement.TransferScheduler.GenerateTransferConstroller(TransferScheduler transferScheduler, TransferJob transferJob, CancellationToken cancellationToken) in TransferScheduler.cs
Microsoft.Azure.Storage.DataMovement.TransferScheduler.ExecuteJobInternalAsync(TransferJob job, CancellationToken cancellationToken) in TransferScheduler.cs
Microsoft.Azure.Storage.DataMovement.SingleObjectTransfer.ExecuteAsync(TransferScheduler scheduler, CancellationToken cancellationToken) in SingleObjectTransfer.cs
Microsoft.Azure.Storage.DataMovement.TransferManager.DoTransfer(Transfer transfer, TransferContext transferContext, CancellationToken cancellationToken) in TransferManager.cs
MyCompany.DocumentService.BlobService.DownloadFile(string path) in BlobService.cs
+
await TransferManager.DownloadAsync(blob, ms);
Have you found a mitigation/solution?
If I get a direct reference to the BlockBlob via _blobContainer.GetBlockBlobReference
, it works as expected, but I find it confusing because I can use CloudBlob.DownloadToStreamAsync
instead, and I don’t need to know the underlying BlobType.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Microsoft.Azure.Storage.DataMovement not able to ...
current I fixed issue for download using azcopy.exe provided Microsoft.
Read more >Transfer data with the Data Movement library - Azure
Upload files and directories to Blob Storage. Define the number of parallel operations when transferring data. Track data transfer progress.
Read more >Untitled
Solved: Blob storage connector and Firewalls - 403 for any. javascript - Node.js can TransferManager.DownloadAsync: blob type BlockBlob ...
Read more >azblob
Package azblob allows you to manipulate Azure Storage containers and blobs objects.
Read more >Azure Blob Storage Upload API's
This includes any accessible object, inside or outside of Azure. If the object is an Azure source, it must be a block blob...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@metoule Thanks for the change suggestion of error message! We will consider to fix it in a future release.
@metoule
This issue is almost same as https://github.com/Azure/azure-storage-net-data-movement/issues/33
To accelerate the transfer, DMlib use different APIs related to different BlobTypes to do Blob transfer, so the blobType need to be defined before input the blob object to DMlib.
And since CloudBlob doesn’t have the blobtype related APIs, but only CloudBlockBlob,CloudPageBlob,CloudAppendBlob have, so we Need these Type Object to run the blob transfer. And We can’t convert CloudBlob directly to these type object in DMlib code, since some blob property might missing in the convert and take bugs.
For your scenario, we would suggest you create CloubBlockBlob object to run download.