Anomalies triggering other workflows from main workflow custom steps
Hi,
I've built a workflow (monet-notification) that triggers 3 other workflow, each one is triggered in its own custom step and the Activity Feed resulting from the execution is a bit surprising to me.
After triggering the workflow monet-notification, on Novu Cloud connected by Local Studio tunnel to my local application that implements the Novu Framework, I see 4 items in the Activity Feed, see attached workflow_with_subworkflows_saas.png.
The first item reports the execution of workflow monet-notification and has 3 custom steps where the other workflows execution are triggered. The other 3 items report the execution of the workflows triggered by those custom steps, but instead of having the correct workflow names they are all named "Deleted Template".
The workflow does whts I expect and i receive the email from them, but "Deleted Template" seems odd and I wonder if I'm doing something wrong
this is the code for the first custom step, that triggers the worflow
await step.custom("trigger-workflow-monetMailClienteConValutazioneNegativa", async () => {
try {
console.log("trigger-workflow-monetMailClienteConValutazioneNegativa")
const triggerParams = {
to: {
subscriberId,
email,
},
payload: payload,
}
console.log(
triggerParams: ${JSON.stringify(triggerParams)}
)
// console.log(JSON.stringify(subscriber));
// console.log(JSON.stringify({
// to: subscriberId,
// payload: payload,
// }));
await monetMailClienteConValutazioneNegativa.trigger(triggerParams);
return {
success: true,
error: null,
};
} catch (error) {
return {
success: false,
error: error,
};
}
});3 Replies
The same workflow doesn't work if I run it on Novu 2.0.0 on premise, see attached workflow_with_subworkflows_on_premise.png.
In the activity feed I only see the item for "monet-notification", the other workflows are not triggered and no mails are sent.
Can you help me fix this problem?
The problem of Novu on premise seems to be that the trigger of nested workflows is done with the same transactionId of the main workflow.
TransactionId behaves as an idempotency key, so only the first request with that key gets executed and novu discards the trigger requests of nested workflows.
This doesn't happen on the cloud version, so maybe the problem is known.
Does it make sense for you?
P.S. We tried updating to version 2.0.1 and nothing changes, don't know about 2.1.0
@Matteo Grolla
Thanks for all the details with this question. I appreciate. It made it easy to understand the issue.
As you said, you have not tried with 2.1.0 version. Is it possible for you to verify in that version also?
@Pawan Jain thank you so much for the response. We’ll try the upgrade to v2.1.0 this week and once done I’ll tell you if it solves the problem.
P.s. You are doing a wonderfull job with Novu!
Hi @Pawan Jain we tried v2.1.0 but the behavior is the same