diff --git a/backend/src/api/controllers/user.ts b/backend/src/api/controllers/user.ts index e65179877..e15ef86b2 100644 --- a/backend/src/api/controllers/user.ts +++ b/backend/src/api/controllers/user.ts @@ -200,12 +200,20 @@ export async function sendVerificationEmail( ); } else if (e.errorInfo.code === "auth/too-many-requests") { throw new MonkeyError(429, "Too many requests. Please try again later"); + } else if ( + e.errorInfo.code === "auth/internal-error" && + e.errorInfo.message.toLowerCase().includes("too_many_attempts") + ) { + throw new MonkeyError( + 429, + "Too many Firebase requests. Please try again later" + ); } else { throw new MonkeyError( 500, "Firebase failed to generate an email verification link: " + e.errorInfo.message, - true + " " + JSON.stringify(e) + JSON.stringify(e) ); } } else {