Hi,
im trying to set up my reset password flow following the docs.
Implement Forgot password → email link → set new password using Supabase Auth in Next.js with supabase ssr.
I’m now getting 500 unexpected_failure when I try to send the recovery email (POST /auth/v1/recover).
- My UI just shows “Error sending recovery email”.
- Supabase Logs show multiple:
- POST /auth/v1/recover → 500
- error_code: unexpected_failure
Supabase also shows the generic “Auth server degraded / usually DB trigger/function issue” type message, but I haven’t created any custom triggers/functions.
I'm unsure as to why the email is not able to be sent. Prior to this I got the email to send fine. but when clicking the reset password link in the email didn’t create a session consistently:
Sometimes it landed on my home page with ?code=... in the URL
Sometimes it hits my reset page but updateUser({ password }) returns “Auth session missing!”
I’m trying to follow the PKCE flow with /auth/confirm + verifyOtp
1. I have pasted the email template provided in the docs into my reset email - email template: See img 1
(my reset passowrd route is /reset-password, so i change that in the email template)
2. i have create the file at app/auth/confirm/route.ts and pasted the required code from the docs: See img 2
( I have imported my supabase createClient from @lib/supabase/server)
3. I then created pasted the function in my server actions file:
'async function resetPassword() {
const { data, error } = await supabase.auth.resetPasswordForEmail(email)
}'
I have included my the code in my actions file for this: See img 3
I recognise that my function is called forgotpassword not reset, as im calling this in my forgot password page prior to resetting it.
4. See img 4 for reset password function in actions file
I dont understand what im doing wrong.
Any help would be much appreacited. Apologies in advance if im just blatantly missing something or not understanding something properly.