apm-agent-dotnet icon indicating copy to clipboard operation
apm-agent-dotnet copied to clipboard

[BUG] Http triggered Azure Function throws System.UriFormatException, no support for Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore integration?

Open oysteinthoensisjord opened this issue 11 months ago • 3 comments

APM Agent version

Elastic.Apm.Azure.Functions version 1.26.0

Environment

Operating system and version: At least Windows, but I guess this isn't OS spesific.. .NET Framework/Core name and version Dotnet 8, Azure Functions

Describe the bug

Using the APM package for a HTTP Triggered Azure Function fails when the Azure Function uses the 'Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore' integration. This integration seems to be the default when creating a HTTP Triggerend function app in Visual Studio as well.

When triggering the function, the APM Middleware throws an System.UriFormatException . The exception is thrown in the method Elastic.Apm.Azure.Functions.ApmMiddleware.GetTriggerSpecificData.

To Reproduce

Steps to reproduce the behavior:

  1. Create HTTP Triggered function app and add the middelware ApmMiddelware
  2. Trigger the Function
  3. Watch it failing... AzureFunction APM fail

Expected behavior

The APM integration for Azure Functions should support the default behaviour implemented by Microsofts own templates.

oysteinthoensisjord avatar Mar 20 '24 14:03 oysteinthoensisjord

Do we have any updates on this? I faced this issue too with 1.27.1 Elastic.Apm.Azure.Functions version

SparkenV avatar May 28 '24 11:05 SparkenV

I'm also experiencing this issue on .NET 8 with 1.28.5 Elastic.Apm.Azure.Functions, so I'm guessing its not going to be fixed soon. I'm surprised more aren't running into this. @oysteinthoensisjord or @SparkenV, did you folks ever find solutions for this? Or do we have to omit APM tracking for HTTP triggers now?

willosbourne avatar Aug 29 '24 19:08 willosbourne

The only way I found to add APM to Http triggered functions was to "downgrade" the function to not use the "Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore"-package. This makes it possible to have APM-tracking. The downside is, of course, that we cannot make use of the functionality provided by the extension package.

oysteinthoensisjord avatar Aug 30 '24 06:08 oysteinthoensisjord