Azure.RequestFailedException: The value for one of the HTTP headers is not in the correct format
When working on Azure Functions with Azurite as blob storage emulator on my local computer, I encountered the following error:
Exception: Azure.RequestFailedException: The value for one of the HTTP headers is not in the correct format.
The detailed error message looks like the following:
[2022-07-01T23:15:11.596Z] Status: 400 (The value for one of the HTTP headers is not in the correct format.) [2022-07-01T23:15:11.597Z] ErrorCode: InvalidHeaderValue [2022-07-01T23:15:11.599Z] [2022-07-01T23:15:11.600Z] Additional Information: [2022-07-01T23:15:11.601Z] HeaderName: x-ms-version [2022-07-01T23:15:11.603Z] HeaderValue: 2021-04-10 [2022-07-01T23:15:11.604Z] [2022-07-01T23:15:11.605Z] Content: [2022-07-01T23:15:11.607Z] <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Error> <Code>InvalidHeaderValue</Code> <Message>The value for one of the HTTP headers is not in the correct format. RequestId:7838da6c-68d1-4bc1-99d8-ada7bf3151ff Time:2022-07-01T23:15:11.483Z</Message> <HeaderName>x-ms-version</HeaderName> <HeaderValue>2021-04-10</HeaderValue> </Error> [2022-07-01T23:15:11.610Z] [2022-07-01T23:15:11.611Z] Headers: [2022-07-01T23:15:11.612Z] Server: Azurite-Blob/3.14.0 [2022-07-01T23:15:11.614Z] x-ms-error-code: InvalidHeaderValue [2022-07-01T23:15:11.615Z] x-ms-request-id: 7838da6c-68d1-4bc1-99d8-ada7bf3151ff [2022-07-01T23:15:11.617Z] Date: Fri, 01 Jul 2022 23:15:11 GMT [2022-07-01T23:15:11.618Z] Connection: keep-alive [2022-07-01T23:15:11.620Z] Transfer-Encoding: chunked [2022-07-01T23:15:11.622Z] Content-Type: application/xml [2022-07-01T23:15:11.624Z] [2022-07-01T23:15:11.625Z] at Azure.Storage.Blobs.ContainerRestClient.Create(Nullable`1 timeout, IDictionary`2 metadata, Nullable`1 access, String defaultEncryptionScope, Nullable`1 preventEncryptionScopeOverride, CancellationToken cancellationToken) [2022-07-01T23:15:11.627Z] at Azure.Storage.Blobs.BlobContainerClient.CreateInternal(PublicAccessType publicAccessType, IDictionary`2 metadata, BlobContainerEncryptionScopeOptions encryptionScopeOptions, Boolean async, CancellationToken cancellationToken, String operationName) [2022-07-01T23:15:11.629Z] at Azure.Storage.Blobs.BlobContainerClient.CreateIfNotExistsInternal(PublicAccessType publicAccessType, IDictionary`2 metadata, BlobContainerEncryptionScopeOptions encryptionScopeOptions, Boolean async, CancellationToken cancellationToken)
Environment
The following list are the environment I am working on, which generate the above exception:
- Azurite: 3.14.0
- Azure Function project package versions:
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.6.0" /> <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ApplicationInsights" Version="1.0.0-preview4" /> <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.3.0" OutputItemType="Analyzer" /> <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="5.0.0" /> <PackageReference Include="Azure.Storage.Blobs" Version="12.11.0" />
Resolve the problem
The issue occurred because my blob client package version is not compatible with my Azurite version. Thus to resolve this issue, I upgraded my Azurite version to the latest by using the following command:
npm install -g azurite@3.18.0
References
Use Azurite (Microsoft Azure Storage Emulator) for Development and Testing
info Last modified by Raymond 2 years ago
copyright
This page is subject to Site terms.
comment Comments
No comments yet.
Log in with external accounts
warning Please login first to view stats information.
article
Modern Web Application - Azure App Service ASP.NET Core Logging to Blob Storage
article
Use Azurite (Microsoft Azure Storage Emulator) for Development and Testing
image
Mount Azure Storage Volumes to Container Group
image
.NET Full Text Search on Azure using Apache Lucene
article
Azure Blob Storage - This request is not authorized to perform this operation.
Read more (8)