I'm running into a weird issue with a custom Supabase Auth hook for sending signup emails. Occasionally, when a user signs up, the form shows a Error running hook URI server error and the logs state:
422: Failed to reach hook within maximum time of 5.000000 seconds
422: Failed to reach hook within maximum time of 5.000000 seconds
The user still gets the verification email (though the link doesn't work, since the signup didn't complete). My code[1] is very similar to the example from the docs [2}.
Some details:
* The function is small (~50KB bundle), only imports what’s needed (React Email, Resend, etc). * Boot time is always fast (200–500ms). * The error only happens on
email_action_type === "signup"
email_action_type === "signup"
, and only sometimes (not every signup). * The Resend API isn’t the issue. The email is always sent, even when the error happens. * Timing logs show no single step is consistently slow. * The error is always a 5s timeout from Supabase’s side.
What I've tried:
* Checked bundle size and dependencies (all minimal). * Added timing logs—no obvious bottleneck. * Boot time is always fast
Questions:
* Has anyone else seen this with custom auth hooks? * Any tips for debugging or avoiding these timeouts? * Is there a way to get more granular logs or see what’s happening inside Supabase during these failures?
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.