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:
- Run
supabase db reset
- Register via
signUp
function
const { data, error } = await supabase.auth.signUp({
email,
password,
})
- 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
- fix issue with provider_id https://github.com/supabase/supabase/issues/19620 — committed to cannarron/classroomio by rotimi-best 5 months ago
- chore: seed db with mock data (#164) * chore: populate sql with dummy data * updated seed sql file * updates seed sql file * fix issue with provider_id https://github.com/supabase/supabas... — committed to rotimi-best/classroomio by cannarron 5 months ago
@AndreMiras interesting, the auth team introduced a migration to the auth service which makes the following changes:
auth.identities.id
,auth.identities.provider
)auth.identities.id
toauth.identities.provider_id
auth.identities.provider_id
,auth.identities.provider
)auth.identities.id
This seems to affect
seed.sql
files that were relying on the old schema of theauth.identities
table. I think it should work if you update all lines that contain:to
Note: The
id
should be renamed toprovider_id
and the newid
column inauth.identities
will be generated for you as the primary key on insertion.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 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? 🤔
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 itscreateServerClient()
function to create the Supabase client instance. I then use this instance to callsupabase.auth.signUp
when theAuthApiError
occur.Could this be a bug on the
@Supabase/ssr
package as it is unable to sign up new users while conforming to the pg15auth.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 inseed.sql
that touchesauth.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 withsupabase.auth.signInWithOtp
."null value in column \"provider_id\" of relation \"identities\" violates not-null constraint"