-
Notifications
You must be signed in to change notification settings - Fork 285
Open
Labels
Description
Minimal repro of middleware:
internal sealed class MyMiddleware : IFunctionsWorkerMiddleware
{
public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next)
{
if (await GetInputValueAsync<TaskOrchestrationContext>(context) is { } orchestrationContext)
{
// Do stuff
}
await next.Invoke(context);
}
public static async Task<T?> GetInputValueAsync<T>(FunctionContext context)
{
foreach (var bindingMetadata in context.FunctionDefinition.InputBindings.Values)
{
var functionParameter = context.FunctionDefinition.Parameters.FirstOrDefault(parameter => parameter.Name == bindingMetadata.Name && parameter.Type.IsAssignableTo(typeof(T)));
if (functionParameter != null)
{
return (await context.BindInputAsync<T>(bindingMetadata)).Value;
}
}
return default;
}
}I have middleware which tries reading function inputs as TaskOrchestrationContext so that it can then read its input and set a correlation context based on the input content. This used to work until I recently updated packages, now I get: System.InvalidOperationException: 'Orchestration history state was either missing from the input or not a string value.'
Is there a workaround? Thanks
Reactions are currently unavailable