elastic / apm-agent-dotnet

https://www.elastic.co/guide/en/apm/agent/dotnet/current/index.html
Apache License 2.0
585 stars 208 forks source link

[BUG] "authentication failed: missing or improperly formatted Authorization header: expected 'Authorization: Bearer secret_token' or 'Authorization: ApiKey base64(API key ID:API key) #2152

Closed khteh closed 4 hours ago

khteh commented 1 year ago

APM Agent version

The version of the Elastic.Apm nuget package used 1.22.0

Environment

Production Operating system and version: Ubuntu 23.04 .NET Framework/Core name and version (e.g. .NET 4.6.2, NET Core 3.1.100) : .Net Core 7.0.109 Application Target Framework(s) (e.g. net462, netcoreapp3.1): net7.0

Describe the bug

A clear and concise description of what the bug is. I have APM server and fleet 8.9.0 running in my k8s cluster and seen the following error today:

[my-apm-server-7f75cffcf7-grj2t apm-server] {"log.level":"error","@timestamp":"2023-08-08T05:32:12.641Z","log.logger":"request","log.origin":{"file.name":"middleware/log_middleware.go","file.line":58},"message":"authentication failed: missing or improperly formatted Authorization header: expected 'Authorization: Bearer secret_token' or 'Authorization: ApiKey base64(API key ID:API key)'","service.name":"apm-server","url.original":"/intake/v2/events","http.request.method":"POST","user_agent.original":"apm-agent-dotnet/1.22.0+1248195c387cac21578a0da4ff22835d4fd5f1d4 (orders-apm 1.0) System.Net.Http/7.0.523.17405 .NET_7/7.0.5","source.address":"10.0.29.219","http.request.id":"5dfb2feb-3328-4af6-9b3c-b0d0b12ffb8b","event.duration":68170,"http.response.status_code":401,"error.message":"authentication failed: missing or improperly formatted Authorization header: expected 'Authorization: Bearer secret_token' or 'Authorization: ApiKey base64(API key ID:API key)'","ecs.version":"1.6.0"}

APM agent config:

{
    "ElasticApm": {
        "ServiceName": "orders-apm",
        "SecretToken": "",
        "ServerUrl": "https://my-apm-http:8200",
        "TransactionSampleRate": 1.0,
        "VerifyServerCert": false,
        "TransactionIgnoreUrls": "/health/*"
    }
}

To Reproduce

Steps to reproduce the behavior:

  1. Use this config '...'
  2. Then call '....'
  3. Then do '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Actual behavior

stevejgordon commented 2 weeks ago

@khteh, further apologies. Is this still an issue, and how does it relate to #2174?

stevejgordon commented 4 hours ago

Closing as stale