Supabase · api · fg-0205

Supabase signUp fails with Database error saving new user after adding a profiles trigger

If you see AuthApiError: Database error saving new user (500, unexpected_failure), the cause and the fix for Supabase are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
AuthApiError: Database error saving new user (500, unexpected_failure)Inviting a user from the dashboard fails with the same messageSignups worked until a trigger on auth.users was added
Cause
A trigger on auth.users runs inside the signup transaction, so any error in it (missing column, NOT NULL, wrong search_path, missing grant) rolls back the whole signup. The Auth role does not see unqualified public tables unless the function is security definer with a fixed search_path.
Fix
Declare the function security definer with search_path set to empty, fully qualify every table, make inserted columns nullable or defaulted, and read the real error in the Auth and Postgres logs.
Apply
create or replace function public.handle_new_user() returns trigger language plpgsql security definer set search_path = '' as $$ begin insert into public.profiles (id, full_name) values (new.id, new.raw_user_meta_data ->> 'full_name'); return new; end; $$;
Affected
Supabase Auth on hosted and self-hosted projects with triggers or constraints on auth.users
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun