Azurite: UseDevelopmentStorage=true - Fails with 'The value for one of the HTTP headers is not in the correct format'

Which service(blob, file, queue, table) does this issue concern?

Blob

Which version of the Azurite was used?

3.14

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

Visual Studio - running Azure functions

What’s the Node.js version?

N/A

What problem was encountered?

Cannot create a container - ‘The value for one of the HTTP headers is not in the correct format’ using the recommended “UseDevelopmentStorage=true” Connection. See https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio#connection-strings

I can create an Azure table - but not a blob container.

Steps to reproduce the issue?

string endPoint = “UseDevelopmentStorage=true”;

//This works with the Development endPoint
var serviceClient = new TableServiceClient(endPoint);
serviceClient.CreateTableIfNotExists("mytable");

var blobServiceClient = new BlobServiceClient(endPoint);

//This fails using the same endpoint - The value for one of the HTTP headers is not in the correct format
var containerClient = blobServiceClient.CreateBlobContainer("mycontainer");

If possible, please provide the debug log using the -d parameter, replacing <pathtodebuglog> with an appropriate path for your OS, or review the instructions for docker containers:

-d "<pathtodebuglog>"

Providing the log is not easy to do - given that I am relying on the Azure Core tools to run the environment and that defines the location of the log. This appears to be the relevant section from the log.

2022-05-04T13:51:02.100Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 info: BlobStorageContextMiddleware: RequestMethod=PUT RequestURL=http://127.0.0.1/devstoreaccount1/azure-webjobs-hosts/locks/timssurface2-2051300736/host?comp=lease RequestHeaders:{“host”:“127.0.0.1:10000”,“x-ms-lease-action”:“renew”,“x-ms-lease-id”:“0000000000000000000000009A8DF540”,“x-ms-version”:“2020-08-04”,“accept”:“application/xml”,“x-ms-client-request-id”:“3dbd6ed9-d43b-4353-8734-3454e47128a9”,“x-ms-return-client-request-id”:“true”,“user-agent”:“azsdk-net-Storage.Blobs/12.9.0 (.NET 6.0.3; Microsoft Windows 10.0.19043)”,“x-ms-date”:“Wed, 04 May 2022 13:51:02 GMT”,“authorization”:“SharedKey devstoreaccount1:hjbw0ANc4GDsyuSAUmdrjkpCxsF6caAx2s9x1zlBYlw=”,“content-length”:“0”} ClientIP=127.0.0.1 Protocol=http HTTPVersion=1.1 2022-05-04T13:51:02.100Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 info: BlobStorageContextMiddleware: Account=devstoreaccount1 Container=azure-webjobs-hosts Blob=locks/timssurface2-2051300736/host 2022-05-04T13:51:02.100Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 verbose: DispatchMiddleware: Dispatching request… 2022-05-04T13:51:02.101Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 info: DispatchMiddleware: Operation=Blob_RenewLease 2022-05-04T13:51:02.102Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 verbose: AuthenticationMiddlewareFactory:createAuthenticationMiddleware() Validating authentications. 2022-05-04T13:51:02.102Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 info: PublicAccessAuthenticator:validate() Start validation against public access. 2022-05-04T13:51:02.102Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 debug: PublicAccessAuthenticator:validate() Getting account properties… 2022-05-04T13:51:02.102Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 debug: PublicAccessAuthenticator:validate() Retrieved account name from context: devstoreaccount1, container: azure-webjobs-hosts, blob: locks/timssurface2-2051300736/host 2022-05-04T13:51:02.102Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 debug: PublicAccessAuthenticator:validate() Skip public access authentication. Cannot get public access type for container azure-webjobs-hosts 2022-05-04T13:51:02.102Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 info: BlobSharedKeyAuthenticator:validate() Start validation against account shared key authentication. 2022-05-04T13:51:02.102Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 info: BlobSharedKeyAuthenticator:validate() [STRING TO SIGN]:“PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-client-request-id:3dbd6ed9-d43b-4353-8734-3454e47128a9\nx-ms-date:Wed, 04 May 2022 13:51:02 GMT\nx-ms-lease-action:renew\nx-ms-lease-id:0000000000000000000000009A8DF540\nx-ms-return-client-request-id:true\nx-ms-version:2020-08-04\n/devstoreaccount1/devstoreaccount1/azure-webjobs-hosts/locks/timssurface2-2051300736/host\ncomp:lease” 2022-05-04T13:51:02.102Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 info: BlobSharedKeyAuthenticator:validate() Calculated authentication header based on key1: SharedKey devstoreaccount1:hjbw0ANc4GDsyuSAUmdrjkpCxsF6caAx2s9x1zlBYlw= 2022-05-04T13:51:02.102Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 info: BlobSharedKeyAuthenticator:validate() Signature 1 matched. 2022-05-04T13:51:02.102Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 verbose: DeserializerMiddleware: Start deserializing… 2022-05-04T13:51:02.102Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 info: HandlerMiddleware: DeserializedParameters={“options”:{“requestId”:“3dbd6ed9-d43b-4353-8734-3454e47128a9”,“modifiedAccessConditions”:{}},“comp”:“lease”,“leaseId”:“0000000000000000000000009A8DF540”,“version”:“2020-08-04”,“action”:“renew”} 2022-05-04T13:51:02.103Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 verbose: SerializerMiddleware: Start serializing… 2022-05-04T13:51:02.103Z 6d0c7665-974d-4a9d-a380-9daa9832ca83 info: EndMiddleware: End response. TotalTimeInMS=3 StatusCode=200 StatusMessage=undefined Headers={“server”:“Azurite-Blob/3.14.1”,“etag”:“"0x1D83B825394DD80"”,“last-modified”:“Wed, 04 May 2022 13:49:14 GMT”,“x-ms-lease-id”:“0000000000000000000000009A8DF540”,“x-ms-client-request-id”:“3dbd6ed9-d43b-4353-8734-3454e47128a9”,“x-ms-request-id”:“6d0c7665-974d-4a9d-a380-9daa9832ca83”,“x-ms-version”:“2020-10-02”,“date”:“Wed, 04 May 2022 13:51:02 GMT”} 2022-05-04T13:51:14.097Z fe90b32a-e5d5-40b9-867b-d210f60e131c info: BlobStorageContextMiddleware: RequestMethod=PUT RequestURL=http://127.0.0.1/devstoreaccount1/azure-webjobs-hosts/locks/timssurface2-2051300736/host?comp=lease RequestHeaders:{“host”:“127.0.0.1:10000”,“x-ms-lease-action”:“renew”,“x-ms-lease-id”:“0000000000000000000000009A8DF540”,“x-ms-version”:“2020-08-04”,“accept”:“application/xml”,“x-ms-client-request-id”:“ce9d0c06-7c9a-4047-b639-d3ee189047d1”,“x-ms-return-client-request-id”:“true”,“user-agent”:“azsdk-net-Storage.Blobs/12.9.0 (.NET 6.0.3; Microsoft Windows 10.0.19043)”,“x-ms-date”:“Wed, 04 May 2022 13:51:14 GMT”,“authorization”:“SharedKey devstoreaccount1:cRgHwGdl38BZS1LzyNX1tfqb660zdRIWbeyH9bFFQ/4=”,“content-length”:“0”} ClientIP=127.0.0.1 Protocol=http HTTPVersion=1.1 2022-05-04T13:51:14.097Z fe90b32a-e5d5-40b9-867b-d210f60e131c info: BlobStorageContextMiddleware: Account=devstoreaccount1 Container=azure-webjobs-hosts Blob=locks/timssurface2-2051300736/host 2022-05-04T13:51:14.097Z fe90b32a-e5d5-40b9-867b-d210f60e131c verbose: DispatchMiddleware: Dispatching request… 2022-05-04T13:51:14.097Z fe90b32a-e5d5-40b9-867b-d210f60e131c info: DispatchMiddleware: Operation=Blob_RenewLease 2022-05-04T13:51:14.097Z fe90b32a-e5d5-40b9-867b-d210f60e131c verbose: AuthenticationMiddlewareFactory:createAuthenticationMiddleware() Validating authentications. 2022-05-04T13:51:14.097Z fe90b32a-e5d5-40b9-867b-d210f60e131c info: PublicAccessAuthenticator:validate() Start validation against public access. 2022-05-04T13:51:14.098Z fe90b32a-e5d5-40b9-867b-d210f60e131c debug: PublicAccessAuthenticator:validate() Getting account properties… 2022-05-04T13:51:14.098Z fe90b32a-e5d5-40b9-867b-d210f60e131c debug: PublicAccessAuthenticator:validate() Retrieved account name from context: devstoreaccount1, container: azure-webjobs-hosts, blob: locks/timssurface2-2051300736/host 2022-05-04T13:51:14.098Z fe90b32a-e5d5-40b9-867b-d210f60e131c debug: PublicAccessAuthenticator:validate() Skip public access authentication. Cannot get public access type for container azure-webjobs-hosts 2022-05-04T13:51:14.098Z fe90b32a-e5d5-40b9-867b-d210f60e131c info: BlobSharedKeyAuthenticator:validate() Start validation against account shared key authentication. 2022-05-04T13:51:14.098Z fe90b32a-e5d5-40b9-867b-d210f60e131c info: BlobSharedKeyAuthenticator:validate() [STRING TO SIGN]:“PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-client-request-id:ce9d0c06-7c9a-4047-b639-d3ee189047d1\nx-ms-date:Wed, 04 May 2022 13:51:14 GMT\nx-ms-lease-action:renew\nx-ms-lease-id:0000000000000000000000009A8DF540\nx-ms-return-client-request-id:true\nx-ms-version:2020-08-04\n/devstoreaccount1/devstoreaccount1/azure-webjobs-hosts/locks/timssurface2-2051300736/host\ncomp:lease”

Please be sure to remove any PII or sensitive information before sharing!
The debug log will log raw request headers and bodies, so that we can replay these against Azurite using REST and create tests to validate resolution.

Have you found a mitigation/solution?

No - I have tried various connection strings.

About this issue

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

Most upvoted comments

For anyone else that is having this issue with a .NET based Azure Function: After updating Visual Studio the Azurite version was upgraded and everything worked.

@TimDaborn

I get why you meet this error. It’s because the “Azure.Storage.Blobs 12.12.0” use API version “2021-06-08” by default, which is still not supported by Azurite 3.14.x. (3.14.x support API version up to “2020-10-02”) If you use latest Azurite 3.17.1, it won’t have this issue.

If you can’t upgrade azurite, there are 2 ways to workaround it:

  1. Start Azurite with parameter “–skipapiversioncheck”, So Azurite won’t report error when the API version is not supported
  2. Specific the API version with run the blob request with latest blob SDK, like :
// specify API version as 2020-10-02 when create blob service client, so all request send from it and it's child object will use this specific API version
var blobServiceClient = new BlobServiceClient(endPoint, new BlobClientOptions(BlobClientOptions.ServiceVersion.V2020_10_02));

 //This will success on azurite 3.14.x when API version is specified as above
 var containerClient = blobServiceClient.CreateBlobContainer("mycontainer");

For long term, I will discuss with Visual studio team to see if they can add “–skipapiversioncheck” in start Azurite in VS.

I can confirm I am getting the same issue on version Azurite-Blob/3.14.3

@TimDaborn For the API version match, you can check Azurite change log and blob SDK change log, they both contain the information of the API version of the release. And Azurite support all API versions before the last supported API version. Following is the match as I see:

Azure.Storage.Blobs 12.9.0 = Azurite 3.13(2020-08-04) Azure.Storage.Blobs 12.10.0 = Azurite 3.14 (2020-10-02) Azurite 3.15 (2021-02-12) Azure.Storage.Blobs 12.11.0 = Azurite 3.16 (2021-04-10) Azure.Storage.Blobs 12.12.0 = Azurite 3.17 (2021-06-08)

This applies to blob/Queue/Table.