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.

[BUG] Azure.Storage.Blob 12.11.0 Exception: InvalidHeaderValue

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
navba-MSFTcommented, May 13, 2022

@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.

1reaction
navba-MSFTcommented, May 13, 2022

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

InvalidHeaderValue Error in ADLS2 Blob trigger function ...
If you are using azurite (Storage emulator) while executing the function locally then this is a known issue.
Read more >
Azure.RequestFailedException: The value for one of the HTTP ...
When working on Azure Functions with Azurite as blob storage emulator on my local computer, I encountered the following error:.
Read more >
azure.storage.blob package — Azure SDK for Python 2.0.0 ...
There is a partial failure in batch operations. Parameters. message (str) – The message of the exception. response – Server response to be...
Read more >
CreateIfNotExists error 400 - Microsoft Q&A
Can't tell what is producing this error. Used Azure Storage Explorer to confirm the Account and blob directory (server NOT emulated ... Common...
Read more >
Versioning for Azure Storage
This section details known issues for the Azure Storage REST APIs. InvalidHeaderValue error message. In rare scenarios, applications making ...
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