Resend 429
If send more than 10 emails per second, the resend will return a 429 like this.
But novu does not handle this. Novu does not auto retry the request, and even does not mark the sent as fail.
13 Replies
Hi @Bryan, 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:
* Overview
* Firebase Cloud Messaging (FCM)
* Activity Feed
* NextJS
-----------------------------
Answer
Sorry, I wasn't able to find any information about your question.
Got it. Tagging @Support for additional help.
novu does not show http response code in log, but the
id
field is missing in 429 response.@Bryan, you just advanced to level 1!
https://github.com/novuhq/novu/blob/1c07c82ebd3a717baebfe814290cb9b868d1acb7/providers/resend/src/lib/resend.provider.ts#L32
https://github.com/resend/resend-node/blob/canary/src/resend.ts#L60
If there's an error, resend sdk won't throw an error, and novu does not check the
error
field. I think this can be fixed easily.
And now there's only one problem: Is there any existing logic for other providers to handle 429?@Pawan Jain can you help out here?
@Bryan
Looking into this.
@Bryan
This will be fixed in this PR
https://github.com/novuhq/novu/pull/5351
Thanks for sharing the issue 🙂
Is there any logic to auto retry the error (or at least 429 error)? I think this may be very useful since all the email providers may encounter the rate limit.
@Bryan
We have failure retry feature in the roadmap. But that will not be helpful with error like this. Above error happened because your account is either in free tier or you have rate limit of only 10 requests per second, I will suggest to reach out to resend to increase the limit
Knows that. But I think it'll be helpful since I only get this error occasionally (especially when I just send notifications to a batch of users).
Both free and paid tiers of Resend have a 10 mails per second rate limit by default (I'm using a paid plan). I will contact support to increase rate limit. But I also think implementing a rate-limiting features in Novu side will be helpful - All email providers must have a rate-limit feature, and we will eventually encounter this problem
@Bryan I agree with 100%
how would you use Novu's rate limit? is it to track usage? or allow to switch between providers?
I think basically it can auto-postpone message sending if the rate exceeds the limits.
And it will be much better if I can add multiple services for "load balancing" multiple providers.
@Bryan so too seperate solutions/ideas
1. Load balance of providers based on rule setting
2. Throughput control, would you use limit + provider priority here?
cc @Dima Grossman @radek @Pawan Jain
I agree that a rate limiting backoff mechanism with a fallback provider is the way to go 👌
Currently don’t have any ETA for the implementation of this, but will keep posted on this thread. Quickest win would be around a back off retry for us