Azure / azure-functions-dapr-extension

Extension for interacting with Dapr APIs from an Azure Function
MIT License
95 stars 33 forks source link

DaprPublishOutput not sending message #196

Open SnowFox108 opened 1 month ago

SnowFox108 commented 1 month ago

I've developed a Durable Function in Isolated worker. DaprPublishOutput doesn't seem to work for me. It's not generating any errors, but it's failing to send out messages.

[DaprPublishOutput(PubSubName = "%PubSubName%", Topic = "{topicName}")]

I've conducted tests with the same setup using In-process and the Dapr client with PublishEvent, and both of them are functioning correctly as well.

raorugan commented 1 month ago

may i know the version of PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version and PackageReference Include="Microsoft.Azure.Functions.Worker" Version in your .csproj file

SnowFox108 commented 1 month ago

It's as following

    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.4" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.20.1" />
raorugan commented 1 month ago

can you please try with the following change of version and let us know
PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.15.1" PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.19.0"

SnowFox108 commented 1 month ago

Now I got the following error message. It's very strange, that I have tried either pass object model or string (serialized), both not working.

2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] Exception: System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $ | LineNumber: 0 | BytePositionInLine: 1. 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] ---> System.InvalidOperationException: Cannot get the value of a token type 'StartObject' as a string. 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedString(JsonTokenType tokenType) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.Utf8JsonReader.GetString() 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] --- End of inner exception stack trace --- 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.DeserializeAsObject(Utf8JsonReader& reader, ReadStack& state) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.JsonSerializer.ReadFromSpanAsObject(ReadOnlySpan1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable1 actualByteCount) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.JsonSerializer.Deserialize(ReadOnlySpan1 utf8Json, Type returnType, JsonSerializerOptions options) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Azure.Core.Serialization.JsonObjectSerializer.Deserialize(Stream stream, Type returnType, CancellationToken cancellationToken) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.ObjectConverterShim.Deserialize(String data, Type targetType) in //src/Worker.Extensions.DurableTask/ObjectConverterShim.cs:line 32 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.DurableTask.Worker.Shims.JsonDataConverterShim.Deserialize(String data, Type objectType) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at DurableTask.Core.TaskOrchestrationContext.ScheduleTaskInternal(String name, String version, String taskList, Type resultType, Object[] parameters) in //src/DurableTask.Core/TaskOrchestrationContext.cs:line 123 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at DurableTask.Core.TaskOrchestrationContext.ScheduleTaskToWorker[TResult](String name, String version, String taskList, Object[] parameters) in //src/DurableTask.Core/TaskOrchestrationContext.cs:line 92 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at DurableTask.Core.TaskOrchestrationContext.ScheduleTask[TResult](String name, String version, Object[] parameters) in //src/DurableTask.Core/TaskOrchestrationContext.cs:line 84 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.DurableTask.Worker.Shims.TaskOrchestrationContextWrapper.CallActivityAsync[T](TaskName name, Object input, TaskOptions options) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Creation.Isolated.Function.Test.Workflows.TestWorkflow.TestOrchestrator(TaskOrchestrationContext context) in C:\Projects\Creation.Isolated.Function\Test\Workflows\TestWorkflow.cs:line 45 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Creation.Isolated.Function.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\Projects\Creation.Isolated.Function\obj\Debug\net8.0\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 74 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.FunctionsHttpProxyingMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\FunctionsMiddleware\FunctionsHttpProxyingMiddleware.cs:line 34 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.FunctionsOrchestrator.EnsureSynchronousExecution(FunctionContext functionContext, FunctionExecutionDelegate next, FunctionsOrchestrationContext orchestrationContext) in //src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs:line 81 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.FunctionsOrchestrator.RunAsync(TaskOrchestrationContext context, Object input) in //src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs:line 51 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] Stack: at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.DeserializeAsObject(Utf8JsonReader& reader, ReadStack& state) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.JsonSerializer.ReadFromSpanAsObject(ReadOnlySpan1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable1 actualByteCount) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at System.Text.Json.JsonSerializer.Deserialize(ReadOnlySpan1 utf8Json, Type returnType, JsonSerializerOptions options) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Azure.Core.Serialization.JsonObjectSerializer.Deserialize(Stream stream, Type returnType, CancellationToken cancellationToken) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.ObjectConverterShim.Deserialize(String data, Type targetType) in /_/src/Worker.Extensions.DurableTask/ObjectConverterShim.cs:line 32 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.DurableTask.Worker.Shims.JsonDataConverterShim.Deserialize(String data, Type objectType) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at DurableTask.Core.TaskOrchestrationContext.ScheduleTaskInternal(String name, String version, String taskList, Type resultType, Object[] parameters) in /_/src/DurableTask.Core/TaskOrchestrationContext.cs:line 123 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at DurableTask.Core.TaskOrchestrationContext.ScheduleTaskToWorker[TResult](String name, String version, String taskList, Object[] parameters) in /_/src/DurableTask.Core/TaskOrchestrationContext.cs:line 92 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at DurableTask.Core.TaskOrchestrationContext.ScheduleTask[TResult](String name, String version, Object[] parameters) in /_/src/DurableTask.Core/TaskOrchestrationContext.cs:line 84 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.DurableTask.Worker.Shims.TaskOrchestrationContextWrapper.CallActivityAsync[T](TaskName name, Object input, TaskOptions options) 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Creation.Isolated.Function.Test.Workflows.TestWorkflow.TestOrchestrator(TaskOrchestrationContext context) in C:\Projects\Creation.Isolated.Function\Test\Workflows\TestWorkflow.cs:line 45 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Creation.Isolated.Function.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\Projects\Creation.Isolated.Function\obj\Debug\net8.0\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 74 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.FunctionsHttpProxyingMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\FunctionsMiddleware\FunctionsHttpProxyingMiddleware.cs:line 34 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.FunctionsOrchestrator.EnsureSynchronousExecution(FunctionContext functionContext, FunctionExecutionDelegate next, FunctionsOrchestrationContext orchestrationContext) in /_/src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs:line 81 2024-06-07 14:08:40 [2024-06-07T13:08:40.354Z] at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.FunctionsOrchestrator.RunAsync(TaskOrchestrationContext context, Object input) in /_/src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs:line 51. 2024-06-07 14:08:40 [2024-06-07T13:08:40.432Z] Executed 'Functions.TestOrchestrator' (Failed, Id=3dd3a2b5-d3d6-4c83-9da9-a5237a82deeb, Duration=160ms) 2024-06-07 14:08:40 [2024-06-07T13:08:40.432Z] System.Private.CoreLib: Exception while executing function: Functions.TestOrchestrator. Microsoft.Azure.WebJobs.Extensions.DurableTask: The JSON value could not be converted to System.String. Path: $ | LineNumber: 0 | BytePositionInLine: 1. 2024-06-07 14:08:40 [2024-06-07T13:08:40.439Z] 95af0f063099528780aa1111edaaa0c4: Function 'TestOrchestrator (Orchestrator)' failed with an error. Reason: The JSON value could not be converted to System.String. Path: $ | LineNumber: 0 | BytePositionInLine: 1.. IsReplay: False. State: Failed. RuntimeStatus: Failed. HubName: HUB01. AppName: . SlotName: . ExtensionVersion: 2.13.2. SequenceNumber: 19. TaskEventId: -1 2024-06-07 14:08:40 [2024-06-07T13:08:40.505Z] Executing 'Functions.TradeCreationOrchestrator' (Reason='(null)', Id=27e37607-2148-4708-a0bb-b442b4f5b18b) 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] An error occurred while executing the orchestrator function 'TradeCreationOrchestrator'. 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] Result: An error occurred while executing the orchestrator function 'TradeCreationOrchestrator'. 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] Exception: Microsoft.DurableTask.TaskFailedException: Task 'TestOrchestrator' (#3) failed with an unhandled exception: The JSON value could not be converted to System.String. Path: $ | LineNumber: 0 | BytePositionInLine: 1. 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] ---> DurableTask.Core.Exceptions.SubOrchestrationFailedException: Exception of type 'DurableTask.Core.Exceptions.SubOrchestrationFailedException' was thrown. 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at DurableTask.Core.TaskOrchestrationContext.CreateSubOrchestrationInstanceCore[T](String name, String version, String instanceId, Object input, IDictionary2 tags) in //src/DurableTask.Core/TaskOrchestrationContext.cs:line 191 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Microsoft.DurableTask.Worker.Shims.TaskOrchestrationContextWrapper.CallSubOrchestratorAsync[TResult](TaskName orchestratorName, Object input, TaskOptions options) 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] --- End of inner exception stack trace --- 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Microsoft.DurableTask.Worker.Shims.TaskOrchestrationContextWrapper.CallSubOrchestratorAsync[TResult](TaskName orchestratorName, Object input, TaskOptions options) 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Creation.Isolated.Function.TradeCreationWorkflow.TradeCreationOrchestrator(TaskOrchestrationContext context) in C:\Projects\Creation.Isolated.Function\TradeCreationWorkflow.cs:line 92 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Creation.Isolated.Function.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\Projects\Creation.Isolated.Function\obj\Debug\net8.0\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 86 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.FunctionsHttpProxyingMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\FunctionsMiddleware\FunctionsHttpProxyingMiddleware.cs:line 34 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.FunctionsOrchestrator.EnsureSynchronousExecution(FunctionContext functionContext, FunctionExecutionDelegate next, FunctionsOrchestrationContext orchestrationContext) in //src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs:line 81 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.FunctionsOrchestrator.RunAsync(TaskOrchestrationContext context, Object input) in //src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs:line 51 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] Stack: at Microsoft.DurableTask.Worker.Shims.TaskOrchestrationContextWrapper.CallSubOrchestratorAsync[TResult](TaskName orchestratorName, Object input, TaskOptions options) 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Creation.Isolated.Function.TradeCreationWorkflow.TradeCreationOrchestrator(TaskOrchestrationContext context) in C:\Projects\Creation.Isolated.Function\TradeCreationWorkflow.cs:line 92 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Creation.Isolated.Function.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\Projects\Creation.Isolated.Function\obj\Debug\net8.0\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 86 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.FunctionsHttpProxyingMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\FunctionsMiddleware\FunctionsHttpProxyingMiddleware.cs:line 34 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.FunctionsOrchestrator.EnsureSynchronousExecution(FunctionContext functionContext, FunctionExecutionDelegate next, FunctionsOrchestrationContext orchestrationContext) in //src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs:line 81 2024-06-07 14:08:40 [2024-06-07T13:08:40.556Z] at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.FunctionsOrchestrator.RunAsync(TaskOrchestrationContext context, Object input) in /_/src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs:line 51. 2024-06-07 14:08:40 [2024-06-07T13:08:40.564Z] Executed 'Functions.TradeCreationOrchestrator' (Failed, Id=27e37607-2148-4708-a0bb-b442b4f5b18b, Duration=63ms) 2024-06-07 14:08:40 [2024-06-07T13:08:40.564Z] System.Private.CoreLib: Exception while executing function: Functions.TradeCreationOrchestrator. Microsoft.Azure.WebJobs.Extensions.DurableTask: Task 'TestOrchestrator' (#3) failed with an unhandled exception: The JSON value could not be converted to System.String. Path: $ | LineNumber: 0 | BytePositionInLine: 1. 2024-06-07 14:08:40 [2024-06-07T13:08:40.565Z] 76675dd751514c149e414413c1a2519c: Function 'TradeCreationOrchestrator (Orchestrator)' failed with an error. Reason: Task 'TestOrchestrator' (#3) failed with an unhandled exception: The JSON value could not be converted to System.String. Path: $ | LineNumber: 0 | BytePositionInLine: 1.. IsReplay: False. State: Failed. RuntimeStatus: Failed. HubName: HUB01. AppName: . SlotName: . ExtensionVersion: 2.13.2. SequenceNumber: 20. TaskEventId: -1`