Azure / azure-functions-durable-extension

Durable Task Framework extension for Azure Functions
MIT License
717 stars 271 forks source link

WaitForInstanceCompletionAsync does not report SerializedOutput even if I see it with durable function monitor #2968

Closed Banchio closed 2 weeks ago

Banchio commented 2 weeks ago

Description

dotnet 8 isolated, durable orchestration migrated from one of the sample (Chirper Service). After giving up on the WaitForCompletionOrCreateCheckStatusResponseAsync for other reasons (will be different issue), I tried to use WaitForInstanceCompletionAsync and then read SerializedOutput but it always return null.

NOTE: JavaScript issues should be reported here: https://github.com/Azure/azure-functions-durable-js

Expected behavior

in the OrchestrationMetadata.SerializedOutput I want to see the output of my orchestration.

Actual behavior

OrchestrationMetadata.SerializedOutput is null

Relevant source code snippets

 [Function("UserTimelineGet")]
 public static async Task<HttpResponseData> UserTimelineGet(
     [HttpTrigger(AuthorizationLevel.Function, "get", Route = "user/{userId}/timeline")] HttpRequestData req,
     [DurableClient] DurableTaskClient client,
     ILogger log,
     string userId)
 {
     var instanceId = await client.ScheduleNewOrchestrationInstanceAsync(nameof(GetTimeline), userId);

     // return await client.WaitForCompletionOrCreateCheckStatusResponseAsync(req, instanceId);
     var result = await client.WaitForInstanceCompletionAsync(instanceId);

     var response = req.CreateResponse(HttpStatusCode.OK);
     await response.WriteStringAsync(result.SerializedOutput ?? string.Empty);
     return response;

 }

Known workarounds

None

App Details

If deployed to Azure

not yet

Banchio commented 2 weeks ago

I probably should had not work on this on saturday, I noticed there is an optional parameter to get inputs and outputs while waiting for instance completion. Closing this one, thanks!