novu
novu copied to clipboard
🐛 Bug Report: Delayed digested flow digests but sends notification multiple times
📜 Description
My workflow as follows:
- I delay the messages with a scheduledAt parameter to wait until a certain time (tomorrow 8AM for example)
- I then put a digest block to combine those delayed messages into a "Daily update mail" for 10 seconds (assuming the workflow won't take much time to send them to the next block)
It seems if I am sending 2 messages like this, it sends me 2 digested notifications (with the same content) instead of 1
👟 Reproduction steps
Make workflow like this:



With this content in the in-app notification:
Total events in digest: {{step.total_count}}
{{#if step.digest}}
{{#each step.events}}
{{test}}
{{/each}}
{{else}}
Not a digested template
{{/if}}
Send 2 events like this:
{
"name": "test-digest-delay",
"to": {
"subscriberId": "3",
"email": "[email protected]"
},
"payload": {
"scheduledAt": "2022-10-11T13:42:00.992Z",
"test": "1"
}
}
👍 Expected behavior
It should digest and send me one notification
👎 Actual Behavior with Screenshots
it sends 2 digested notifications

💻 Operating system
MacOS
🤖 Node Version
Stable (16.x)
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
- [X] I checked and didn't find similar issue
🏢 Have you read the Contributing Guidelines?
- [X] I have read the Contributing Guidelines
Are you willing to submit PR?
Yes I am willing to submit a PR!
@ainouzgali could you please take a look at this one? I don't see a reason of why it might not work.
Yes, I will look into it.
@ainouzgali any luck?
Unfortunately, no luck yet @sebastiaanviaene . But I'm on it, will keep you updated
Were you able to reproduce it?
Yes, I've been working on it @sebastiaanviaene. But it's a bit tricky because of the way our queue works.
It's a very specific bug of Digest coming after a Scheduled Delay that has been triggered more than once for the exact same scheduled date.
If you need a workaround just for now, you could try scheduling the sendAt parameter for 1 or 2 seconds more than the sendAt of your first trigger.
For example - if your first trigger has "sendAt": "2022-10-12T17:52:15.694Z"
then for the next triggers try using "sendAt": "2022-10-12T17:52:17.694Z"
But I am working on a fix - I will keep you updated :)
@ainouzgali Thank you for the workaround and looking into it! I see its already fixed 😄
Hi @sebastiaanviaene, the fix was merged to main branch. This will be included in the closest release (v0.9.0).
Hi, I'm Jarvis 🤖
I'm a bot built to help you with your contribution to Novu. I will add instructions and guides on how to run the subset of the Novu platform associated to this issue and make your first contribution.
This issue was tagged as related to @novu/api
and the related code is located at the apps/api
folder, here is how I can help you:
First time contributing to Novu?
If that's the first time you want to contribute to Novu here are a few simple steps to get you started:
- Fork the repository and clone your fork to your local machine.
- Install the dependencies using
npm run setup:project
. - Create a new branch with the number of the issue, for example:
1454-fix-something-cool
and start contributing based on the Contributing Guide or the short guide in the section below. - Create a Pull request and follow the template of creation
Run and test `@novu/api` locally
Run API in watch mode
The easiest way to start the API is to run npm run start:api
from the root of the repository
Run API integration tests
To validate your changes or simply to run the e2e tests run npm run start:e2e:api
. All the e2e tests have the .e2e.ts
suffix and usually are located near the controller files of each module.