Closed dzejsien closed 3 months ago
This happens for us too, but only sporadically. According to app insights around 1/10 of the time. It started yesterday at around 14:00 UTC (16:00+0200). We also run on dotnet 8, isolated worker, and on an app service plan with no other services on it.
@fabiocav No direspect, however your change in patch 4.34.2, commit c7323b4, has changes in the forwarding service and the timeline of the error showing up kinda lines up. :) Thanks for looking at it!
Edit: Nevermind, we're running function host 4.34.1.1 which exactly doesn't yet include your fix I mentioned above.
This happens in our Azure function too.
Running net8.0 in isolated worker. Function host is also 4.34.1.1. StackTrace is exactly the same as in the initial post.
Our health function looks like this. Nothing special in it.
[Function("Health")]
public static IActionResult Health(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)]
HttpRequest req)
{
return new StatusCodeResult(StatusCodes.Status200OK);
}
We recently started seeing this in our function app as well. Any solution or reason why this is happening ?
We have also been seeing this for a just under a week now. I have a vague memory of looking at this previously and seeing that 4.34.2 might fix it, but it seems like maybe that was only a change and has not been confirmed as a fix?
If there is a fix, is it possible to get an indication of a rollout timeline? This is a bit of an annoyance for us as it is failing http triggered requests that have otherwise succeeded, causing retries from third parties to those endpoints.
We are seeing this too, with the most basic 'Ping' function. Sporadically, not for every request.
Runtime version 4.34.1.1 - also would like an indication of when the fix will be rolled out.
We are seeing the same thing as well. The endpoint we are getting these errors on is a vanilla health check endpoint that just returns 200 response, almost identical to the code @cplankl posted.
Runtime version - 4.34.1.22669 dotnet-isolated .net6.0
Also seeing this and it's causing issues for alerting. Roughly 1 failure per hour, but still intermittent. 4.34 runtime, dotnet-isolated, net8.0. Please advise or get in a fix for this...
I'm seeing this problem happen if I add a custom middleware to a basic function.
Code to reproduce
Middleware moved to ConfigureFunctionsWebApplication.
var host = new HostBuilder()
.ConfigureAppConfiguration((_, config) =>
config
.AddJsonFile("appsettings.json", true, true)
.AddDefaultAzureAppConfiguration(...)
.AddUserSecrets(Assembly.GetExecutingAssembly(), true))
.ConfigureFunctionsWebApplication(configureWorker =>
{
// The Middlewares
configureWorker.UseMiddleware<CustomMiddleware>();
})
@gsayem Does moving the middleware helps to prevent errors ? Thanks
@gsayem In my code I do not add custom middlewares:
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var configuration = new ConfigurationBuilder()
.SetBasePath(Environment.CurrentDirectory)
.AddEnvironmentVariables()
.Build();
var host = new HostBuilder()
.ConfigureFunctionsWebApplication()
.ConfigureServices(services =>
{
services.AddApplicationInsightsTelemetryWorkerService();
services.ConfigureFunctionsApplicationInsights();
})
.Build();
host.Run();
However, ConfigureFunctionsWebApplication()
will probably register middlewares but it is also a recommendation from Microsoft to do so:
This example includes ASP.NET Core integration to improve performance and provide a familiar programming model when your app uses HTTP triggers. If you do not intend to use HTTP triggers, you can replace the call to ConfigureFunctionsWebApplication with a call to ConfigureFunctionsWorkerDefaults. If you do so, you can remove the reference to Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore from your project file. However, for the best performance, even for functions with other trigger types, you should keep the FrameworkReference to ASP.NET Core.
@gsayem Does moving the middleware helps to prevent errors ? Thanks
I think yes, also my errors are gone when I moved my middleware.
@gsayem In my code I do not add custom middlewares:
using Microsoft.Azure.Functions.Worker; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; var configuration = new ConfigurationBuilder() .SetBasePath(Environment.CurrentDirectory) .AddEnvironmentVariables() .Build(); var host = new HostBuilder() .ConfigureFunctionsWebApplication() .ConfigureServices(services => { services.AddApplicationInsightsTelemetryWorkerService(); services.ConfigureFunctionsApplicationInsights(); }) .Build(); host.Run();
However,
ConfigureFunctionsWebApplication()
will probably register middlewares but it is also a recommendation from Microsoft to do so:This example includes ASP.NET Core integration to improve performance and provide a familiar programming model when your app uses HTTP triggers. If you do not intend to use HTTP triggers, you can replace the call to ConfigureFunctionsWebApplication with a call to ConfigureFunctionsWorkerDefaults. If you do so, you can remove the reference to Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore from your project file. However, for the best performance, even for functions with other trigger types, you should keep the FrameworkReference to ASP.NET Core.
This should work, I tried your example and it's working as expected.
@gsayem I tried out your recommendation. The error has gone away for me now. I don't fully understand the difference between ConfigureFunctionsWorkerDefaults
and ConfigureFunctionsWebApplication
but that seemed to have fixed it for me.
We're having the same issue and making the ConfigureFunctionsWebApplication to ConfigureFunctionsWorkerDefaults change isn't really an option due to the size of the change. Is there any timeline on a fix?
@jviau I assume you can support here. Fix for https://github.com/Azure/azure-functions-host/issues/10119 didn't help.
At least from my side, the issue has been fixed with no action from my side in the new runtime version 4.34.2.2
Yes 4.34.2.2 seems to be fine.
I'm running it in a docker container in image mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated8.0-appservice
Is there an easy way to get information about which runtime version is used in which docker image?
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
ISSUE:
I have 2 functions:
Startup:
When HC Function is executed, the ex is thrown, nevertheless HC returns Healthy.
Message: Exception while executing function: Functions.HealthCheck The function invocation context is missing the forwarding task property.
Please support.