chore: catch firebase internal errors when trying to auth

This commit is contained in:
Miodec 2025-06-14 14:11:05 +02:00
parent 8843c50d71
commit 2d008461ed

View file

@ -191,6 +191,17 @@ async function authenticateWithBearerToken(
email: decodedToken.email ?? "",
};
} catch (error) {
if (
error instanceof Error &&
error.message.includes("An internal error has occurred")
) {
throw new MonkeyError(
503,
"Firebase returned an internal error when trying to verify the token.",
"authenticateWithBearerToken"
);
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const errorCode = error?.errorInfo?.code as string | undefined;