Is there some cache of the actors data?
Stumbled upon such issue:
We are using actor.firstName and actor.lastName in some of our workflows.
I've created new development subscriber. Triggered notification. Saw that accidentally subscriber was created with empty firstName and lastName. Updated subscriber information using bulkCreate. Tried to trigger new notifications and still subscriber information is empty (I've updated subscriber info more than 20 minutes ago).
It all happened in development environment.
Is there some sort of cache on subscribers information or what can be an issue?
10 Replies
Hi @Dima_hat, I'm an AI assistant for Novu. While a team member reviews this question, I'll look through relevant sources and see if I can provide suggestions. Please tag @Ask Inkeep with any follow-up questions.
-----------------------------
While I generate an answer, here are some sources that might be helpful:
* Bulk trigger event
* General
* Concepts
* Update subscriber online status
-----------------------------
Answer
Based on the information provided, it seems you're encountering an issue where updating subscriber information using
bulkCreate
does not reflect the updated information when triggering notifications. This behavior may relate to how subscribers are handled within Novu, particularly when it comes to updating existing subscribers.
When you use the trigger
function in Novu, and you specify subscriber information, Novu performs an upsert operation. This means it will either create a new subscriber with the provided information or update an existing subscriber if the subscriberId
matches. The key point here is that the update operation only updates fields that are explicitly passed. If you need to reset a field, you must explicitly pass null
for that field (1) .
However, your specific issue seems related to a known bug where after deleting a subscriber, trying to recreate subscribers with the same subscriberId
using bulkCreate
does not recreate the subscriber as expected. This behavior was noted in a bug report stating that subscribers that were previously deleted and then attempted to be recreated using bulkCreate
would not actually be recreated, showing no subscriber in the list or UI, and trying to get such a subscriber would result in a 404 error (2) .
Given this context, the issue may not be related to caching but rather how subscribers are managed and updated within the Novu system, especially when using bulkCreate
for updates. If the subscriber's subscriberId
was previously associated with a deleted subscriber, it might be part of the problem described in the bug report.
Unfortunately, there isn't a direct mention of a caching mechanism that could affect subscriber information updates. Your best course of action might be to follow up on the status of the bug report and check if there's a workaround or fix. Additionally, ensuring that the
subscriberId
is unique and has not been associated with a deleted subscriber might help avoid this issue.Got it. Tagging @Support for additional help.
After updating information by subscribers.identify - the issue is gone and information of the actor is properly displayed
But after using bulkUpdate (so when issue was happening) - the web UI showed correct data (not empty strings for firstName and lastName)
@Dima_hat I am not 100% sure about that, bug might be due to notification already scheduled before hand, but I can't be sure. Also, another good option is to use defaults. @Pawan Jain @Moderator something else you can thing as to why actor data was not updated?
Some of messaged where sent after changing of the subscribers data, when I saw thriugh the UI that data was changed already, but in messages it still arrived empty.
Only after calling
subscribers.identify
- it started working properly. Can it be that there is some difference in behavior of subscribers.bulk
and subscribers.identify
methods?@Dima Grossman @Pawan Jain please take a look at this one
@Dima_hat
I am trying to reproduce the issue.
1. I created two subscribers with only subscriberid using identify method
2. Updated those two subscribers firstname, lastname using bulk create
3. Created a workflow having in-app step with actor variables
4. used one of the above subscriber as actor and step2 firstname is showing as expected.
Did I miss something?
Workflow was created and existed long before the creation of the subscribers.
I think the steps in our case where
1. Creating workflow and use it for some period of time (not sure if such usage can affect anything)
2. Creating new subscriber using identify.
3. Triggering workflow with this subscriber as an actor.
4. Updating subscriber information using bulk create.
5. Triggering workflow again. And here was still info from the second step and not from the forth.
6. Updating user info using identify seems to fix the issue.
Unfortunately right now cannot check if the issue still exists, but I believe these were the steps that we have used
Thanks @Dima_hat
I will try to reproduce this again