Skip to content

Supabase Auth errorSupabase sign-up fails with “Database error saving new user”

New users can’t sign up, or inviting a user from the dashboard fails, and Supabase returns Database error saving new user. Supabase says it is normally a side effect of the database transaction, and lists a trigger on auth.users first among its three common causes. Here’s what its docs say to check, in their own words, or hand it over at a fixed price.

Short answer

Supabase lists three common causes: a trigger or trigger function on auth.users that has an error, a constraint on auth.users that isn’t met, or Prisma breaking the permissions on that table. Open the Auth logs first, then the Postgres logs, for the exact error. A frequent one is a handle_new_user trigger inserting into a profiles table that doesn’t exist.

What to check, in order

  1. 01

    Read the exact error in the logs

    “The logs surface the specific error message and give you the most direct signal about what went wrong.” Supabase, Database error saving new user

    Start in the Auth logs explorer in your project dashboard. If they point at the database, open the Postgres logs: Supabase’s example there names the function and the line that failed.

  2. 02

    A trigger on auth.users fails

    “A trigger on auth.users is calling a function (in this case handle_new_user) that tries to insert into a table that does not exist.” Supabase, Database error saving new user

    Many apps copy a profile row into public.profiles when someone signs up. If that table is missing, renamed or doesn’t match what the function inserts, every sign-up fails. Create the table if it should exist, or update or remove the reference in the function on the Database Functions page.

  3. 03

    Users were added with SQL, not the Auth API

    “A direct insert can leave required columns as NULL when the Auth service expects an empty string.” Supabase, Database error saving new user

    If users were inserted straight into auth.users, by hand or by an AI tool running a SQL INSERT, the logs show Database error querying schema with an error like converting NULL to string is unsupported on confirmation_token, usually when those users sign in. Supabase’s fix sets that column, or whichever one the error names, to an empty string where it is NULL.

    update auth.users
    set confirmation_token = ''
    where confirmation_token is null;
  4. 04

    Duplicate key on profiles at sign-up

    “If the trigger fails, it could block signups, so test your code thoroughly.” Supabase, Managing user data

    We also see duplicate key value violates unique constraint on the profiles table when two things insert the same profile, such as the trigger and the app’s own code after signUp(). We keep one of them, or make the trigger’s insert skip an existing row with on conflict do nothing, then test a fresh sign-up.

  5. 05

    A constraint on auth.users, or Prisma

    “You are using Prisma and it has broken all the permissions on the auth.users table” Supabase, Database error saving new user

    Supabase also lists a constraint added to auth.users that isn’t being met. Check for constraints on that table, and if the project uses Prisma, check the table’s permissions.

Checked against the vendor’s docs on : Supabase troubleshooting: Database error saving new user; Supabase docs: Managing user data.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

Related: Supabase new row violates row-level security · Supabase Email not confirmed · Supabase migration failed on db push · Supabase public storage bucket

Questions

More on this error

Does it also happen when I invite users from the dashboard?

Yes. Supabase says you generally get this error when inviting a new user from the dashboard or inserting one in the table editor, and you may also see it in logs for failed sign-ups. The checks are the same.

Should I just delete the trigger?

Only if nothing needs what it creates. Supabase says that if the table is not needed, review the function definition and update or remove the reference. If the app reads profiles, fix the function instead.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; we reply by email, usually within one business day.