You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in src/functions/hello.ts add the following code on the beginning of const helloOrchestrator: OrchestrationHandler context.log('-----context.df.isReplaying:', context.df.isReplaying); context.log('-----context.triggerMetadata.isReplaying:', context.triggerMetadata.isReplaying);
Call the orchestrator
Expected behavior
Expecting to get boolean value from context.df.isReplaying
Actual behavior context.df.isReplaying is always undefined
Screenshots
Known workarounds
I believe the correct value for isReplaying is coming context.triggerMetadata.isReplaying
Additional context
I’m trying to build an Azure durable function in TypeScript using the programming model v4.
Sadly during my tests I noticed that every context.log is logged multiple times.
After digging in, I’ve learned that it’s one of the weirdest things in the Durable functions.
However based on Azure documentation about App Logging I should be able to resolve this issue by simply checking if the context.df.isReplaying is false. eg: if (!context.df.isReplaying) context.log("Calling F1.");
Believe me or not but this is not working.
Every single time I’m getting that context.df.isReplaying is undefined.
After few experiments I’m able to get the correct value for isReplaying but from context.triggerMetadata.isReplaying.
I started thinking that there should be something wrong with how I implemented my durable functions, however even the durable functions starter from Azure documentation is giving me the same result
Is this a bug in the Azure programming model v4 or their documentation is not updated?
Do you think I could rely on context.triggerMetadata.isReplaying?
The text was updated successfully, but these errors were encountered:
I've encountered this as well but I've discovered more information when testing with the basic "Hello" activity template. Instead of yielding to an array, I changed it to yield to it's own variable.
constactivityName="DurableFunctionsHelloActivity";constorchestratorName="DurableFunctionsOrchestrator";exportconstdurableFunctionsOrchestrator: OrchestrationHandler=function*(context: OrchestrationContext){logIfNotReplaying(context,`Received request to orchestrator ${orchestratorName}`);constoutput1=yieldcontext.df.callActivity(activityName,"Tokyo");// line 7constoutput2=yieldcontext.df.callActivity(activityName,"Seattle");// line 8constoutput3=yieldcontext.df.callActivity(activityName,"Cairo");// line 9logIfNotReplaying(context,`Processed orchestrator with outputs ${output1}${output2}${output3}`);return[output1,output2,output3];};constlogIfNotReplaying=(context: OrchestrationContext,message: string): void=>{constisReplayString=context.triggerMetadata.isReplayingasstring;if(isReplayString=='False'){context.log(message);}};df.app.orchestration(orchestratorName,durableFunctionsOrchestrator);
context.triggerMetadata.isReplaying is 'False' until after the first callActivity and then for the rest of the orchestrator's life (line 8 and on) it is set to 'True' regardless of whether it has handled the next activity yet or not. So this is not a reliable replacement.
context.df.isReplaying is undefined until after a callActivity processes. So put a break point on line 8. First time that break point is hit, it changes to false. After the 2nd time it hits the break point (meaning 2nd callActivity processed and intends to go to the 3rd callActivity) then it changes to true but only during the breakpoint on line 8. A second break point on line 9 would show the value immediately go back to false.
So there's definitely a bug to this context.df.isReplaying value. I've confirmed this with durable-functions version 3.0.0 and latest.
Describe the bug
context.df.isReplaying is always undefined.
I'm able to get isReplaying from context.triggerMetadata.isReplaying
Investigative information
To Reproduce
context.log('-----context.df.isReplaying:', context.df.isReplaying); context.log('-----context.triggerMetadata.isReplaying:', context.triggerMetadata.isReplaying);
Expected behavior
Expecting to get boolean value from context.df.isReplaying
Actual behavior
context.df.isReplaying is always undefined
Screenshots
Known workarounds
I believe the correct value for isReplaying is coming context.triggerMetadata.isReplaying
Additional context
I’m trying to build an Azure durable function in TypeScript using the programming model v4.
Sadly during my tests I noticed that every context.log is logged multiple times.
After digging in, I’ve learned that it’s one of the weirdest things in the Durable functions.
However based on Azure documentation about App Logging I should be able to resolve this issue by simply checking if the context.df.isReplaying is false. eg:
if (!context.df.isReplaying) context.log("Calling F1.");
Believe me or not but this is not working.
Every single time I’m getting that context.df.isReplaying is undefined.
After few experiments I’m able to get the correct value for isReplaying but from context.triggerMetadata.isReplaying.
I started thinking that there should be something wrong with how I implemented my durable functions, however even the durable functions starter from Azure documentation is giving me the same result
Is this a bug in the Azure programming model v4 or their documentation is not updated?
Do you think I could rely on context.triggerMetadata.isReplaying?
The text was updated successfully, but these errors were encountered: