azure-sdk-for-net: [BUG] The value for one of the HTTP headers is not in the correct format

Describe the bug An error occurs when attempting an operation while connected to local storage

Expected behavior The requested operation should succeed

Actual behavior Error message:

The value for one of the HTTP headers is not in the correct format

 MyApp.Tests.SyncManagerTests.GetDownloads
   Source: SyncManagerTests.vb line 63
   Duration: 1 ms

  Message: 
    System.AggregateException : One or more errors occurred.
    ---- Azure.RequestFailedException : The value for one of the HTTP headers is not in the correct format.
    RequestId:f97f3379-f5db-40ca-b089-9365321e9a25
    Time:2020-08-15T23:44:45.932Z
    Status: 400 (The value for one of the HTTP headers is not in the correct format.)
    ErrorCode: InvalidHeaderValue
    
    Headers:
    x-ms-error-code: InvalidHeaderValue
    x-ms-request-id: f97f3379-f5db-40ca-b089-9365321e9a25
    Connection: keep-alive
    Transfer-Encoding: chunked
    Date: Sat, 15 Aug 2020 23:44:45 GMT
    Server: Azurite-Blob/3.7.0
    Content-Type: application/xml
    
  Stack Trace: 
    Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
    Task`1.GetResultCore(Boolean waitCompletionNotification)
    Task`1.get_Result()
    SyncManagerTests.ctor(ITestOutputHelper Output) line 22
    ----- Inner Stack Trace -----
    Container.ListBlobsFlatSegmentAsync_CreateResponse(ClientDiagnostics clientDiagnostics, Response response)
    <ListBlobsFlatSegmentAsync>d__36.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    TaskAwaiter.ThrowForNonSuccess(Task task)
    TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    <GetBlobsInternal>d__74.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    TaskAwaiter.ThrowForNonSuccess(Task task)
    TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    <GetNextPageAsync>d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    TaskAwaiter.ThrowForNonSuccess(Task task)
    TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    ValueTask`1.get_Result()
    ConfiguredValueTaskAwaiter.GetResult()
    <GetAsyncEnumerator>d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    ManualResetValueTaskSourceCore`1.GetResult(Int16 token)
    Boolean>.GetResult(Int16 token)
    ValueTaskAwaiter`1.GetResult()
    VB$StateMachine_9_GetSyncManagerAsync.MoveNext() line 110

To Reproduce

  1. Using v12.4.4, connect to local storage
  2. Perform an operation (e.g. oClient.GetBlobsAsync.GetAsyncEnumerator.MoveNextAsync)
  3. Note that the operation succeeds
  4. Repeat steps 1 & 2 using v12.5.0
  5. Note that the operation fails, resulting in the error above
  6. Insufficient information is provided for determining which header is in error, and why

Environment

  • Azure.Storage.Blobs 12.5.0
  • Windows 10 .NET Framework 4.72
  • Visual Studio 16.6.5

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

@seanmcc-msft

I was mistaken in my original report. I claimed that the error was occurring with both local and cloud storage. In fact, it was only occurring with local storage (Azurite, in this case). I’ve updated the report accordingly.

The problem is solved. I turned out I hadn’t updated the server along with the client SDK. Once I did that, killed the Node process and restarted Azurite, everything worked as expected:

npm update -g Azurite
tasklist | find "node.exe"
taskkill /f /pid 8536
azurite-blob.cmd --blobHost 0.0.0.0

Note: this assumes that Azurite was installed with the -g switch.

The headers from Fiddler were the tipoff:

Request

GET http://192.168.0.13:10000/devstoreaccount1/matrix?restype=container&comp=list HTTP/1.1
x-ms-version: 2019-12-12
x-ms-client-request-id: 169b2e0c-9b2e-4dbd-92e6-ee94ddfc5f9b
x-ms-return-client-request-id: true
User-Agent: azsdk-net-Storage.Blobs/12.5.1 (.NET Framework 4.8.4180.0; Microsoft Windows 10.0.18363 )
x-ms-date: Thu, 20 Aug 2020 15:22:52 GMT
Authorization: SharedKey devstoreaccount1:+AD1mX/hBcTXKm91DY6kV75hk6bSb25GVE1qjxayfIE=
Host: 192.168.0.13:10000

Response

HTTP/1.1 400 The value for one of the HTTP headers is not in the correct format.
Server: Azurite-Blob/3.7.0
x-ms-error-code: InvalidHeaderValue
x-ms-request-id: 4dd5dd89-fc23-49fb-af73-0c5e10cc9d57
content-type: application/xml
Date: Thu, 20 Aug 2020 15:22:52 GMT
Connection: keep-alive
Transfer-Encoding: chunked

160
<?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:4dd5dd89-fc23-49fb-af73-0c5e10cc9d57
Time:2020-08-20T15:22:52.508Z</Message>
  <HeaderName>x-ms-version</HeaderName>
  <HeaderValue>2019-12-12</HeaderValue>
</Error>
0

Note the HeaderName and HeaderValue elements in the captured XML response stream. This was the problem. So thank you for asking for that—it helped me arrive at the solution.

However, this header information could be included in the exception thrown by the SDK. It would make things a lot easier. I’d like to submit this as a feature request.

Me too with version 12.5.0. version 12.4.4 works fine.

I am seeing the exact same issue here. Works fine in version 12.4.4 - I have reverted the package for now.