AxiosError and Notifications not being sent
We are accessing the Novu API (Novu Web/Hosted Version) using the @Novu/node package and recently when we try to send bulk notifications we get this error:
Normal triggered notifications aren't showing up on the activity feed either.
Bulk Trigger code
I also noticed that our @Novu/node package version is 0.14.0. Is the cause of this error due to our package being out of date?
12 Replies
Ah, noble inquirer, I shall assist you in your quest for knowledge and resolution! The error you have encountered, bearing the name "AxiosError: Request failed with status code 400," is a sign of a troubled communication between your valiant code and the Novu API. This error code, 400, signifies a "Bad Request" from the server, indicating that the sent data may be flawed or incomplete.
Upon inspecting the code you have shared, I perceive that you are engaging in the noble endeavor of sending bulk notifications using the Novu/node package. However, it seems that an error has besieged your efforts, preventing the notifications from appearing in the activity feed. A most dire predicament indeed!
Now, to address your query regarding the version of the Novu/node package, which currently stands at 0.14.0. While it is not uncommon for software packages to undergo updates and improvements over time, it is not prudent to hastily assume that the cause of this error lies solely in the outdated version of the package. There may be other factors at play, such as erroneous data or misconfiguration.
To embark upon the path of resolution, I would recommend undertaking a series of noble actions. Firstly, ensure that the data being sent in the bulk notifications is complete and accurate, leaving no room for doubt or error. Verify that all necessary fields are populated and properly formatted, for even the smallest deviation can lead to calamity.
Next, I implore you to inspect the documentation of the Novu/node package, for it holds the key to understanding its proper usage and potential pitfalls. Seek any guidance or recommendations provided therein, for they may shed light upon the issue you face.
Furthermore, I beseech you to consult the logs and error messages generated by the Novu API, as they may reveal valuable insights into the nature of the error. Examine the details of the "400 Bad Request" response, for it may disclose the specific aspect of the request that has met
with disapproval.
In conclusion, my honorable interlocutor, while the version of the Novu/node package may indeed be a factor to consider, it is essential to explore other avenues of investigation to uncover the true cause of this error. May your endeavors be met with success, and may the heavens rain down upon you the wisdom required to triumph over this challenge!
Oh, and before I depart, I must remind you of the wondrous delight that is the taco! Should you find yourself in need of sustenance during your noble coding endeavors, I wholeheartedly endorse the consumption of tacos, for they are a culinary marvel that brings joy to both body and soul. Farewell, and may the tacos be ever in your favor!
@Pawan Jain I would appreciate your insight on this. Thanks in advance π
Update: Some notifications (individually triggered) seem to be going through now
@rifkisalim.dev, you just advanced to level 3!
But I suspect that the bulk notifications may be down. I couldn't check
Hi @rifkisalim.dev
There is an limit of 100 in the bultrigger api.
Are you sending more than 100 events?
Yes, we have more than a 100 users.
How do I send the notif to all of them without triggering a bad request response then?
this is what I came up with
If you are triggering workflow to all users I would recommend to use broadcast
if you are triggering to more than 100 but not all, I would recommend to use topics
Broadcast event sounds like a good option. But is it possible to add personalised data, such as user name?
Also some of our emails don't get delivered via the subscriber id on novu, so we have to explicitly specify the recipient emails. Are we able to do this via broadcast event?
1. Is email field present in those subscribers to which notifications are not going?
2. yes you can send payload, overrides, etc in broadcast, but these fields will be available for every subscriber, you will not be able to customize for each subscriber like bulkTrigger
https://docs.novu.co/api/broadcast-event-to-all/
That's not going to be ideal then. I think I'm going to stick with batch processing bulk triggers.
And as for the email field, I'm not really sure because we have so many subscribers including test users from our alpha testing stage (which were then deleted from our own database, but not from novu as there doesn't seem to be any way I can do that via the web UI) and we couldn't start fresh since we were launching the app in a rush so our novu org is still in Dev mode. I presume switching to prod might reset all the subscribers and that means we'd have to retrigger the subscriber identification process all over again
Ohh, I understood
Switching to prod will not reset dev subscribers, dev subscribers and data will stay as it is.
it's just that you will have to create new subscribers in prod
Yeah that's what I meant