"message": "Function 'UpdateCustomerDetails_Orchestrator' failed with an unhandled exception.",
"details": "Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: UpdateCustomerDetails_OrchestratorSystem.InvalidCastException: Unable to cast object of type 'System.String' to type 'Microsoft.Azure.WebJobs.Extensions.DurableTask.IDurableOrchestrationContext'.
at lambda_method172(Closure, HttpTriggerFunction, Object[])
at Microsoft.Azure.WebJobs.Host.Executors.TaskMethodInvoker2.InvokeAsync(TReflected instance, Object[] arguments) in D:\\a\\_work\\1\\s\\src\\Microsoft.Azure.WebJobs.Host\\Executors\\TaskMethodInvoker.cs:line 21 at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker
2.InvokeAsync(Object instance, Object[] arguments) in D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 53
at Microsoft.Azure.WebJobs.Extensions.DurableTask.OutOfProcMiddleware.<>c__DisplayClass10_0.<
this error is encountered after publishing the app it says the orchestrator is failed
"message": "Function 'UpdateCustomerDetails_Orchestrator' failed with an unhandled exception.",
"details": "Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: UpdateCustomerDetails_OrchestratorSystem.InvalidCastException: Unable to cast object of type 'System.String' to type 'Microsoft.Azure.WebJobs.Extensions.DurableTask.IDurableOrchestrationContext'.
at lambda_method172(Closure, HttpTriggerFunction, Object[])
at Microsoft.Azure.WebJobs.Host.Executors.TaskMethodInvoker2.InvokeAsync(TReflected instance, Object[] arguments) in D:\\a\\_work\\1\\s\\src\\Microsoft.Azure.WebJobs.Host\\Executors\\TaskMethodInvoker.cs:line 21 at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker
2.InvokeAsync(Object instance, Object[] arguments) in D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 53
at Microsoft.Azure.WebJobs.Extensions.DurableTask.OutOfProcMiddleware.<>c__DisplayClass10_0.<
this error is encountered after publishing the app it says the orchestrator is failed
Share Improve this question edited Mar 20 at 4:38 Arun Cs asked Mar 19 at 11:50 Arun CsArun Cs 11 bronze badge 2- Provide your function code and more details about the error. – Pravallika KV Commented Mar 19 at 12:00
- Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Bot Commented Mar 19 at 14:38
1 Answer
Reset to default 0Looks like the error is due to how the orchestrator function is being invoked, particularly with the data being passed to it. For example, a string is being passed when an IDurableOrchestrationContext
is expected.
This could also be due to the Durable Functions misconfiguration in portal. Verify the runtime stack in the function app.
Looks like your function is
In-Process
. Check if you have selectedDOTNET-ISOLATED|version(8.0/9.0)
as runtime stack. Change the runtime stack toDOTNET|8.0
.
The function runtime may be misidentifying it due to various reasons as below:
- Invalid trigger attribute
- Deployment mismatch
- Function runtime version conflict
- Incorrect
function.json
generation
- Double-check your function attributes: Make sure the function is properly decorated with
[FunctionName("UpdateCustomerDetails_Orchestrator")]
and uses[OrchestrationTrigger]
. - Delete bin/obj folders of your project, to ensure a clean publish.
- Clean and rebuild your project before publishing to ensure no all DLLs get deployed properly.
- Ensure you're using the correct extension bundles and versions in
host.json
andlocal.settings.json
.
Compare your code structure with the below sample code:
public static class Function1
{
[FunctionName("Function1")]
public static async Task<List<string>> RunOrchestrator(
[OrchestrationTrigger] IDurableOrchestrationContext context)
{
var outputs = new List<string>();
outputs.Add(await context.CallActivityAsync<string>(nameof(SayHello), "Tokyo"));
outputs.Add(await context.CallActivityAsync<string>(nameof(SayHello), "Seattle"));
outputs.Add(await context.CallActivityAsync<string>(nameof(SayHello), "London"));
return outputs;
}
[FunctionName(nameof(SayHello))]
public static string SayHello([ActivityTrigger] string name, ILogger log)
{
log.LogInformation("Saying hello to {name}.", name);
return $"Hello {name}!";
}
[FunctionName("Function1_HttpStart")]
public static async Task<HttpResponseMessage> HttpStart(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestMessage req,
[DurableClient] IDurableOrchestrationClient starter,
ILogger log)
{
string instanceId = await starter.StartNewAsync("Function1", null);
log.LogInformation("Started orchestration with ID = '{instanceId}'.", instanceId);
return starter.CreateCheckStatusResponse(req, instanceId);
}
}
local.settings.json:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_INPROC_NET8_ENABLED": "1",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}