Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
oysteinthoensisjord opened this issue Mar 20, 2024 · 4 comments · Fixed by #2505
Labels
agent-dotnet bug Something isn't working community

Comments

@oysteinthoensisjord
Copy link

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.

@SparkenV
Copy link

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

@willosbourne
Copy link

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?

@oysteinthoensisjord
Copy link
Author

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.

@stevejgordon
Copy link
Contributor

Apologies for the delay in getting to this. Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore, in the current implementation, throws an exception when we access the Url property, which is surprising. We need to rely on different implementation details to access the URL for instrumentation. I will be working on this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-dotnet bug Something isn't working community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants