question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing field CalculateMd5ForResponseStream for DataProtection

See original GitHub issue

Hello,

We are upgrading one of our web apps from .Net Core 2.2 to 3.1 and with that all the packages. Right now we are having problems with our configuration of DataProtection using Azure blob storage. We are using the following version of the package and configuration code:

Microsoft.AspNetCore.DataProtection.AzureStorage 3.1.3

public static void UseAzureDataProtection(this IServiceCollection services, DataProtectionSettings settings)
{
    var credentials = new StorageCredentials(settings.AccountName, settings.AccountKey);
    var cloudStorageAccount = new CloudStorageAccount(credentials, true);
    var cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
    var container = cloudBlobClient.GetContainerReference($"{settings.ApplicationName}-container");

    container.CreateIfNotExistsAsync().GetAwaiter().GetResult();

    services.AddDataProtection().PersistKeysToAzureBlobStorage(container, $"{settings.ApplicationName}-keys.xml");
}

Which throws the following error in the requests pipeline:

An error occurred while reading the key ring.
System.MissingFieldException: Field not found: 'Microsoft.Azure.Storage.Core.Executor.RESTCommand`1.CalculateMd5ForResponseStream'.
   at Microsoft.Azure.Storage.Blob.CloudBlob.GetBlobImpl(BlobAttributes blobAttributes, Stream destStream, Nullable`1 offset, Nullable`1 length, AccessCondition accessCondition, BlobRequestOptions options)
   at Microsoft.Azure.Storage.Blob.CloudBlob.DownloadRangeToStreamAsync(Stream target, Nullable`1 offset, Nullable`1 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, AggregatingProgressIncrementer progressIncrementer, CancellationToken cancellationToken)
   at Microsoft.Azure.Storage.Blob.CloudBlob.DownloadToStreamAsync(Stream target, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
   at Microsoft.AspNetCore.DataProtection.AzureStorage.AzureBlobXmlRepository.GetLatestDataAsync(ICloudBlob blobRef)
   at Microsoft.AspNetCore.DataProtection.AzureStorage.AzureBlobXmlRepository.GetAllElementsAsync(ICloudBlob blobRef)
   at Microsoft.AspNetCore.DataProtection.AzureStorage.AzureBlobXmlRepository.GetAllElements()
   at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.GetAllKeys()
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore(DateTimeOffset now, IKey keyJustAdded)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.ICacheableKeyRingProvider.GetCacheableKeyRing(DateTimeOffset now)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore(DateTime utcNow, Boolean forceRefresh)

If we downgrade the package to the 2.2.7 version, with the same configuration code it works. The only thing is that we also need to update the using’s since they were changed from Microsoft.WindowsAzure.Storage on 2.x.x to Microsoft.Azure.Storage on 3.x.x.

In addition, I can see in the following commit that the field was removed, I just don’t know why it’s still trying to use it: https://github.com/Azure/azure-storage-net/commit/38f703c3d4d94f09f65b2b2f92f4f837d402fc42#diff-6d37e66772ae1b6ed4d77c52778c9336

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
pdl5pcommented, Jun 12, 2020

It’s a couple of months later and I ran into this issue today. The solution that worked for me was to update both packages Microsoft.Azure.Storage.Common and Microsoft.Azure.Storage.Blob from 10.0.3 to 11.1.7.

What was strange to me was that this was a production deployed Function App that suddenly stopped working.

Edit- It turns out the Functions runtime was updated to version 2.0.13759.0 which was the reason that our app stopped working suddenly. Release announcements are documented here https://github.com/Azure/app-service-announcements/issues

2reactions
atlemagnussencommented, Apr 12, 2020

I also get this error, I’m trying to store the keys for the first time just following this excact example: Key storage providers - Azure

..
var container = client.GetContainerReference("my-key-container");
..
.PersistKeysToAzureBlobStorage(container, "keys.xml")

my-key-container is created so the connection is working I even tried uploading the keys.xml created before turning on this feature

I did not try any form of encryption

fail: Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider[48]
      An error occurred while reading the key ring.
System.MissingFieldException: Field not found: 'Microsoft.Azure.Storage.Core.Executor.RESTCommand`1.CalculateMd5ForResponseStream'.
   at Microsoft.Azure.Storage.Blob.CloudBlob.GetBlobImpl(BlobAttributes blobAttributes, Stream destStream, Nullable`1 offset, Nullable`1 length, AccessCondition accessCondition, BlobRequestOptions options)
   at Microsoft.Azure.Storage.Blob.CloudBlob.DownloadRangeToStreamAsync(Stream target, Nullable`1 offset, Nullable`1 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, AggregatingProgressIncrementer progressIncrementer, CancellationToken cancellationToken)
   at Microsoft.Azure.Storage.Blob.CloudBlob.DownloadToStreamAsync(Stream target, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
   at Microsoft.AspNetCore.DataProtection.AzureStorage.AzureBlobXmlRepository.GetLatestDataAsync(ICloudBlob blobRef)
   at Microsoft.AspNetCore.DataProtection.AzureStorage.AzureBlobXmlRepository.GetAllElementsAsync(ICloudBlob blobRef)
   at Microsoft.AspNetCore.DataProtection.AzureStorage.AzureBlobXmlRepository.GetAllElements()
   at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.GetAllKeys()
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore(DateTimeOffset now, IKey keyJustAdded)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.ICacheableKeyRingProvider.GetCacheableKeyRing(DateTimeOffset now)
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore(DateTime utcNow, Boolean forceRefresh)
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to calculate a missing md5 for a file in Azure blob ...
I would use Azure Event Grid / Azure Functions and check if there is the md5 otherwise would calculate and update it.
Read more >
dvc get --show-url fails with missing `md5` key. · Issue #9176
Are you setting the remote: field in each .dvc file to indicate that each directory is only stored in a specific remote? i.e....
Read more >
Using server-side encryption with customer-provided keys ( ...
The entity tag (ETag) in the response is not the MD5 hash of the object data. You manage a mapping of which encryption...
Read more >
md5 hash calculation for large files - Microsoft Q&A
In Azure blob storage I want to upload a file having size more than 5GB into a block. When I went through the...
Read more >
CUCM MD5 hash values - missing info
Solved: So just aquick one on CUCM upgardes. I needs to upgrade my CUCM version from 7.0(2) to 7.0(2a) SU3 as I am...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found