Azure / azure-functions-durable-extension

Durable Task Framework extension for Azure Functions
MIT License
710 stars 263 forks source link

When migrating the durable function with Orchestrator from .Net 6 to .Net 8.0 locally things are working as expected But when deploying the same code it is throwing the RPC exception #2857

Open MrChandanSingh opened 1 week ago

MrChandanSingh commented 1 week ago

Hi Team,

I am facing the similar issue after migrating from .Net 6 to 8.0. It is look like orchestrator is not waiting for activity function to complete activity then go for another activity. but it is not happening . Exception while executing function: Functions.CreateLoadOfferOrchestrator Result: Failure Exception: System.InvalidOperationException: An ExecutionStarted event is required. at DurableTask.Core.OrchestrationRuntimeState.GetExecutionStartedEventOrThrow() in /_/src/DurableTask.Core/OrchestrationRuntimeState.cs:line 210 at Microsoft.DurableTask.Worker.Grpc.GrpcOrchestrationRunner.LoadAndRun(String encodedOrchestratorRequest, ITaskOrchestrator implementation, IServiceProvider services) at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.DurableTaskFunctionsMiddleware.RunOrchestrationAsync(FunctionContext context, BindingMetadata triggerBinding, FunctionExecutionDelegate next) in /_/src/Worker.Extensions.DurableTask/DurableTaskFunctionsMiddleware.cs:line 58 at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 89 at Microsoft.Azure.Functions.Worker.Handlers.InvocationHandler.InvokeAsync(InvocationRequest request) in D:\a\_work\1\s\src\DotNetWorker.Grpc\Handlers\InvocationHandler.cs:line 88 Stack: at DurableTask.Core.OrchestrationRuntimeState.GetExecutionStartedEventOrThrow() in /_/src/DurableTask.Core/OrchestrationRuntimeState.cs:line 210 at Microsoft.DurableTask.Worker.Grpc.GrpcOrchestrationRunner.LoadAndRun(String encodedOrchestratorRequest, ITaskOrchestrator implementation, IServiceProvider services) at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.DurableTaskFunctionsMiddleware.RunOrchestrationAsync(FunctionContext context, BindingMetadata triggerBinding, FunctionExecutionDelegate next) in /_/src/Worker.Extensions.DurableTask/DurableTaskFunctionsMiddleware.cs:line 58 at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 89 at Microsoft.Azure.Functions.Worker.Handlers.InvocationHandler.InvokeAsync(InvocationRequest request) in D:\a\_work\1\s\src\DotNetWorker.Grpc\Handlers\InvocationHandler.cs:line 88 `var host = new HostBuilder() .ConfigureFunctionsWebApplication() .ConfigureAppConfiguration((context, builder) => { builder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); builder.AddEnvironmentVariables(); }) .ConfigureServices((Context, Services) => { Services.AddApplicationInsightsTelemetryWorkerService(); Services.ConfigureFunctionsApplicationInsights(); Services.AddDataAccessDependencies(); Services.AddHttpClient(SamsaraConstants.SamsaraClient, options => { options.DefaultRequestHeaders.Accept.Clear(); }); Services.AddHttpClient(ArcGisConstants.ArcGisClient, options => { options.DefaultRequestHeaders.Accept.Clear(); }); Services.ConfigureCacheAsTransientDependency(Context.Configuration); Services.AddHttpContextAccessor(); Services.AddApiContextAccessor(); Services.RespositoryDependency(); Services.ServiceDependency(); Services.AddNotificationDependencies(); Services.AddAzureSmsDependencies(); }) .Build();

host.Run(); image ` image

clegendre commented 4 days ago

Hi, got the same issue there.

clegendre commented 3 days ago

I think I've found the issue, and it's about extended sessions not supported in Isolated Worker... I was also migrating from .NET 6 to .NET 8 using dotnet-isolated mode, and my host configuration contained the following:

      "extendedSessionsEnabled": true,
      "extendedSessionIdleTimeoutInSeconds": 15,

By removing this, it's working...

MrChandanSingh commented 2 days ago

Able to resolve this issue. No it is working as expected