azure-sdk-for-net: [BUG] Azure.Storage.Blob 12.11.0 Exception: InvalidHeaderValue

Library name and version

Azure.Storage.Blob 12.11.0

Describe the bug

When installing Azure.Storage.Blob 12.11.0 into Class Project that is used by an Azure Function project. The following exception occurs.

image

Expected behavior

Be able to have an Azure Function reference another project that contains a reference to Azure.Storage.Blob 12.11.0

Actual behavior

The Azure Functions starts up but immediately throws the below exception.

image

Reproduction Steps

  • Create an Azure Function Project using the Azure Function template. Add a simple Azure Function like the following
public class Function1
    {
        [FunctionName("BlobTriggerStart")]
        public static async Task BlobTriggerClientFunction(
            [BlobTrigger("{AddContainerName}/{name}", Connection = "{AddConnectionString}")] BlobClient blobClient, string name,
            ILogger log, [DurableClient] IDurableOrchestrationClient starter)
        {
            try
            {
                log.LogInformation($"Started orchestration trigged by BLOB trigger. A blob item with name = '{name}'");
                log.LogInformation($"BLOB Name {blobClient.Name}");

            }
            catch (Exception ex)
            {
                log.LogError("Something went wrong. Error : " + ex.InnerException);
                throw;
            }
        }
    }

  • Run the Azure Function: The project should run like normal

  • Create a Class Project and reference the Azure.Storage.Blob Nuget 12.11.0

    • Note: No other code is needed. Just a reference to the NuGet package.
  • In the Azure Function Project, reference the Class Project

  • Run the Azure Function: The Exception should occur

  • In the Class Project, down grade Azure.Storage.Blob to 12.10.0

    • Run the Azure Function. The project should run like normal

Environment

Windows 10 .NET 6 Visual Studio 17.1.5

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (4 by maintainers)

Most upvoted comments

@ToddEvansHome Thanks for getting back. We will now proceed with closure of this github issue. If you need any further assistance on this issue in future, please feel free to reopen this thread. We would be happy to help.

@ToddEvansHome Thanks for sharing your project. I was able to reproduce the same issue. After doing some debugging, I was able to identify the cause. The 400 error with Invalid Header was due to the x-ms-version: 2021-06-08 being sent by the Blob Storage SDK wasn’t matching the version used by the Azurite.

This is a known issue and it is documented here.

If an incoming request has a higher API version than Azurite, Azurite will return a InvalidHeaderValue error for x-ms-version (HTTP status code 400 - Bad Request).

You can run the below command to find the version of Azurite.

azurite.exe --version

Below are the steps that I followed to fix this issue: I deleted the contents of the below folder.

C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator

The Storage Emulator is available as part of the Microsoft Azure SDK. You can also install the Storage Emulator by using the standalone installer (direct download).

I upgraded my Azurite version to the most recent version 3.17.1 and that resolved the issue.

npm i azurite@3.17.1

Launch Visual Studio again and test the FunctionApp. Hope this helps. Please let me know if you still face this issue. Awaiting your reply.

Todd Evans has shared a OneDrive for Business file with you. To view it, click the link below. https://ebiquityplc365-my.sharepoint.com/:u:/g/personal/todd_evans_ebiquity_com/Ef8R6qguMV9NlRrr2GYEdowB8UVpmSZAaXmMSXR0cCzvTA [https://r1.res.office365.com/owa/prem/images/dc-zip_20.png]https://ebiquityplc365-my.sharepoint.com/:u:/g/personal/todd_evans_ebiquity_com/Ef8R6qguMV9NlRrr2GYEdowB8UVpmSZAaXmMSXR0cCzvTA FunctionApp3.ziphttps://ebiquityplc365-my.sharepoint.com/:u:/g/personal/todd_evans_ebiquity_com/Ef8R6qguMV9NlRrr2GYEdowB8UVpmSZAaXmMSXR0cCzvTA

I was able to successfully(unfortunately) create a new project from an Azure Function template and repo the failure Originally the project was an HTTPTrigger, but when I changed it to BlobTrigger and added Azure.Storage.Blobs 12.11.0, that is when I received the same error message. There is no need for a second project. I have attached a zipped up project.

Please let me know if you have any questions.

Todd Evans

Senior Software Developer

@.@.> Missouri 530 Maryville Centre Dr., Suite 50, St. Louis, MO 63141, USA Tel +1 (636) 812-0117


From: SatishBoddu @.> Sent: Friday, April 29, 2022 10:39 AM To: Azure/azure-sdk-for-net @.> Cc: ToddEvansHome @.>; Mention @.> Subject: Re: [Azure/azure-sdk-for-net] [BUG] Azure.Storage.Blob 12.11.0 Exception: InvalidHeaderValue (Issue #28381)

Hello @FarshanAhamedhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FFarshanAhamed&data=05|01|Todd.Evans%40ebiquity.com|bacc399835a94b7a720708da29f6686b|11f603b048ee4ebe99ef47de1d5be024|0|0|637868435553016979|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=fXMBDdPPWt6l2BQaF6AXp%2FS%2FSbnc%2BwKriNcuIixPwYg%3D&reserved=0 Do you have any Github public code(sanitized) branch where i can take a look at the code snippet quickly for testing from my side?

— Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-sdk-for-net%2Fissues%2F28381%23issuecomment-1113458809&data=05|01|Todd.Evans%40ebiquity.com|bacc399835a94b7a720708da29f6686b|11f603b048ee4ebe99ef47de1d5be024|0|0|637868435553016979|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=fFC8rv6hbxqg4y%2FMvrdld3XzsM1yJLxAgid5sOef31M%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKNJOY744XGUVQ4XBXX5U3DVHP7BZANCNFSM5UKKOT7A&data=05|01|Todd.Evans%40ebiquity.com|bacc399835a94b7a720708da29f6686b|11f603b048ee4ebe99ef47de1d5be024|0|0|637868435553016979|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=x8C9OnYMBnUE31HCdZ0imEgCaV6L5sriQkc3z1vG9zg%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>