supabase: Signup fails: null value in column "provider_id" of relation "identities" violates not-null constraint

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

As of today, whenever I try to sign up I see this error in my local development environment:

null value in column "provider_id" of relation "identities" violates not-null constraint

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Run supabase db reset
  2. Register via signUp function
const { data, error } = await supabase.auth.signUp({
        email,
        password,
      })
  1. Check error return value which contains above mentioned value

Expected behavior

Registration with email and password should work without issues

Screenshots

n/a

System information

  • OS: macOS
  • Browser (if applies): chrome
  • Version of supabase-js: 2.39.0
  • Version of Node.js: 21.0.0

Additional context

My current workaround is to remove the null constraint:

alter table auth.identities alter column provider_id drop not null;

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Reactions: 12
  • Comments: 21 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@AndreMiras interesting, the auth team introduced a migration to the auth service which makes the following changes:

  • Remove the composite primary key on (auth.identities.id, auth.identities.provider)
  • Rename auth.identities.id to auth.identities.provider_id
  • Create a unique constraint on (auth.identities.provider_id, auth.identities.provider)
  • Add a new primary key called auth.identities.id

This seems to affect seed.sql files that were relying on the old schema of the auth.identities table. I think it should work if you update all lines that contain:

INSERT INTO auth.identities (id, user_id, identity_data, provider, last_sign_in_at, created_at, updated_at)

to

INSERT INTO auth.identities (provider_id, user_id, identity_data, provider, last_sign_in_at, created_at, updated_at)

Note: The id should be renamed to provider_id and the new id column in auth.identities will be generated for you as the primary key on insertion.

Are there plans to upgrade the initial schemas on pg15 for Supabase CLI soon?

pg15 doesn’t require initial schema because we run the migrations that came with gotrue docker image.

It’s possible that you have have outdated image versions in supabase/.temp directory locally. Try deleting the directory to reset to the defaults, ie. rm -rf supabase/.temp.

yea my build processes are all failing with the exact same errors /:

I suspect this error is specific to projects on pg14. Please give npx supabase@beta start a try.

Feel free to reopen if this issue still persists.

I have the issue that my local setup auth tables are not up to date with the new provider_id column in identities table. I have “major_version = 15” in supabase/config.toml. I have tried to run it with beta version of CLI and latest release version, no changes. BUT when I change major version to 14 “major_version = 14”, it works as expected with the new provider_id column. It would seem the initial schemas on pg15 are not updated on the CLI.

Hope this helps in some way. ◡̈

@kangmingtay i don’t have anything in seed.sql that inserts into identities table. Are there any other spots as well? 🤔

It’s possible that you have have outdated image versions in supabase/.temp directory locally. Try deleting the directory to reset to the defaults, ie. rm -rf supabase/.temp.

Thanks. This solved it for me!

I was thinking all along that I had outdated images. Just didn’t know it was the .temp folder that held that information. Tried deleting all images and containers without luck. But this did the trick!

@paynwahs update to v1.128.1 solved for me sign up on local

Using Supabase CLI v1.123.6 with pg15, removed supabase/.temp, reset the database and still getting the error (below) when signing up new users on local with supabase.auth.signUp.

AuthApiError: null value in column "provider_id" of relation "identities" violates not-null constraint.

I am able to use seed.sql to populate local Supabase instance using the following code, thus verifing the latest pg15 schema.

INSERT INTO auth.identities (provider_id, user_id, identity_data, provider, last_sign_in_at, created_at, updated_at)

I am using the @Supabase/ssr package and its createServerClient() function to create the Supabase client instance. I then use this instance to call supabase.auth.signUp when the AuthApiError occur.

Could this be a bug on the @Supabase/ssr package as it is unable to sign up new users while conforming to the pg15 auth.identities schema?

Signup fails w/ same error for me as well. I don’t have anything under supabase/.temp and I don’t have anything in seed.sql that touches auth.identities. I am using the latest CLI version ^1.123.4.

Is there a solution to this other than downgrading the CLI version?

Using Supabase CLI v1.123.4 with pg15, removed supabase/.temp, reset the database and still getting the error (below) when signing up new users on local with supabase.auth.signInWithOtp.

"null value in column \"provider_id\" of relation \"identities\" violates not-null constraint"