Open jnsvd opened 2 years ago
This was a change made in the 2.0.0 release of the npm package. It looks like the documentation hasn’t been updated to reflect this change. The examples you’re referring to were for the 1.x versions of this npm module.
FYI: @davidmrdavid @lilyjma
Thanks for reaching out @jnsvd: @cgillum is right, this was one of the breaking changes in the v2 release of the DF NodeJS SDK. It appears we need to take a closer look at our docs to update this guidance, thanks for the report.
You can read our list of breaking changes here: https://github.com/Azure/azure-functions-durable-js/releases/tag/2.0.0
I'm assigning this ticket to myself so I follow-up with the documentation update work.
Describe the bug According to the documentation, to implement an eternal orchestration, one needs to include the following statement:
This leads to an exception
Orchestration yielded data of type undefined. Only Task types can be yielded.Please refactor your orchestration to yield only Tasks.
. When removingyield
, i.e. change the statement intocontext.df.continueAsNew(undefined);
, behavior looks correct.Investigative information
To Reproduce Steps to reproduce the behavior:
module.exports = df.orchestrator(function*(context){ const result = yield context.df.callActivity("AnActivity");
context.log(
Result: ${result}
);const wait = moment.utc(context.df.currentUtcDateTime).add(5, "s"); yield context.df.createTimer(wait.toDate());
yield context.df.continueAsNew(undefined); });
module.exports = async function (context, req) { const client = df.getClient(context); const instanceId = "InstanceId"; await client.startNew(req.params.functionName, instanceId, null);
return client.createCheckStatusResponse(context.bindingData.req, instanceId); };
[2022-06-23T10:02:25.135Z] InstanceId: Function 'EternalOrchestrator (Orchestrator)' failed with an error. Reason: Message: Orchestration yielded data of type undefined. Only Task types can be yielded.Please refactor your orchestration to yield only Tasks., StackTrace: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) [2022-06-23T10:02:25.135Z] at System.Threading.Tasks.Task
1.GetResultCore(Boolean waitCompletionNotification) [2022-06-23T10:02:25.136Z] at System.Threading.Tasks.Task
1.get_Result() [2022-06-23T10:02:25.136Z] at Microsoft.Azure.WebJobs.Extensions.DurableTask.TaskOrchestrationShim.InvokeUserCodeAndHandleResults(RegisteredFunctionInfo orchestratorInfo, OrchestrationContext innerContext) in D:\a_work\1\s\src\WebJobs.Extensions.DurableTask\Listener\TaskOrchestrationShim.cs:line 150. IsReplay: False. State: Failed. HubName: TestHubName. AppName: . SlotName: . ExtensionVersion: 2.7.1. SequenceNumber: 12. TaskEventId: -1 [2022-06-23T10:02:25.146Z] Executed 'Functions.EternalOrchestrator' (Failed, Id=38ceb138-6aa1-411f-b443-f6e6f0ba3694, Duration=39ms) [2022-06-23T10:02:25.146Z] System.Private.CoreLib: Exception while executing function: Functions.EternalOrchestrator. Microsoft.Azure.WebJobs.Extensions.DurableTask: Orchestrator function 'EternalOrchestrator' failed: Orchestration yielded data of type undefined. Only Task types can be yielded.Please refactor your orchestration to yield only Tasks. ^C[2022-06-23T10:02:27.559Z] Language Worker Process exited. Pid=84184. [2022-06-23T10:02:27.559Z] node exited with code 130 (0x82). .