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] Unexpected type for header

See original GitHub issue

Library name and version

Azure.Core 1.29.0

Describe the bug

After upgrading to Azure.Core 1.29.0 (required by Microsoft.Extensions.Azure 1.6.2) we repeatedly receive this error:

System.InvalidOperationException: Unexpected type for header : 
 at Azure.Core.Pipeline.HttpClientTransport.PipelineRequest.GetHttpHeaderValue(String headerName, Object value)
 at Azure.Core.Pipeline.HttpClientTransport.PipelineRequest.EnumerateHeaders()+MoveNext()
 at Azure.Core.Diagnostics.AzureCoreEventSource.FormatHeaders(IEnumerable`1 headers, HttpMessageSanitizer sanitizer)
 at Azure.Core.Diagnostics.AzureCoreEventSource.Request(Request request, String assemblyName, HttpMessageSanitizer sanitizer)\n at Azure.Core.Pipeline.LoggingPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
 at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
 at Azure.Core.Pipeline.RedirectPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)\n at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
 at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
 at Azure.Core.Pipeline.HttpPipeline.SendRequestAsync(Request request, CancellationToken cancellationToken)
 at Azure.Messaging.ServiceBus.Administration.HttpRequestAndResponse.SendHttpRequestAsync(Request request, CancellationToken cancellationToken)\n at Azure.Messaging.ServiceBus.Administration.HttpRequestAndResponse.GetEntityAsync(String entityPath, String query, Boolean enrich, CancellationToken cancellationToken)
 at Azure.Messaging.ServiceBus.Administration.ServiceBusAdministrationClient.GetQueueAsync(String name, CancellationToken cancellationToken)

This does not happen locally. It only occurs when running in a container in AKS using managed identity credentials. Downgrading to Azure.Core 1.28.0 and Microsoft.Extensions.Azure 1.6.0 solves the issue. If it helps we’re using Azure.Messaging.ServiceBus 7.12.0.

Expected behavior

No errors.

Actual behavior

See bug description.

Reproduction Steps

See bug description.

Environment

No response

Issue Analytics

  • State:closed
  • Created 6 months ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
stevendarbycommented, May 19, 2023

We’re still getting an “Unexpected type for header” exception and I think it’s when value is null, which is not handled in this switch expression https://github.com/Azure/azure-sdk-for-net/blob/c03b37ccd7aa206b8a6c9f303b18d23ee093532b/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs#L506-L511 Which for us is a breaking change in a minor package update…

1reaction
kevinharingcommented, Mar 16, 2023

I can confirm it has been fixed in Azure.Core 1.30.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected type for header x-ms-meta-ownerType
While trying to set metadata for file upload in Azure Blob Storage,Getting this error { "isSuccess": false, "statusCode": 500, ...
Read more >
Why Does Azure Domain Verification Not Follow the HTTP ...
EDIT: Also, to be sure, this is the error message I get: "The server returned an unexpected content type header value. [nc186]".
Read more >
Problem with 'error: unknown type name' : r/C_Programming
Hello, I have the following problem. I have typedef alias: typedef cx_ecfp_private_key_t privatekey_t; // In header file 'crypto.h'.
Read more >
syntax error, unexpected 'header' (T_STRING) : r/PHPhelp
I start learning php and i have a problem. Please, help me detected to my mistake! VScode and Apache write about an error...
Read more >
error C2226: syntax error : unexpected type 'std::string' ...
The error has shifted to pointing to the constructor implementation header: error C2226: syntax error : unexpected type 'std::string'
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