Closed gmisail closed 1 year ago
After some experimentation, it seems that everything works as expected once I add my DB_NAMESPACE
as a prefix to every table name. Maybe all that is needed is a quick patch to prepend this string, if it exists. Unless this is intended behavior and I'm missing another configuration somewhere?
This is happenint to be as well, where did you set the prefix? @gmisail
@gmisail this is what postgres logs are
2023-10-09 05:43:27.288 UTC [86] ERROR: relation "identities" does not exist at character 168
2023-10-09 05:43:27.288 UTC [86] STATEMENT: SELECT identities.created_at, identities.id, identities.identity_data, identities.last_sign_in_at, identities.provider, identities.updated_at, identities.user_id FROM identities AS identities WHERE email = $1
Only reason failing is because the ORM does not generate auth.identities with auth prefix
SELECT identities.created_at, identities.id, identities.identity_data, identities.last_sign_in_at, identities.provider, identities.updated_at, identities.user_id FROM auth.identities AS identities WHERE email = 'jonathan'
Create a custom connection string with a custom search path, that's the fix.
Yeah that was the fix, thank you for the help.
@Jonatthu @gmisail could you elaborate what exactly you mean with a custom connection strign with a custom search path?
these are my env vars
GOTRUE_SITE_URL="http://localhost:3004"
GOTRUE_JWT_SECRET="secret"
GOTRUE_DB_DRIVER="postgres"
GOTRUE_DB_NAMESPACE="auth"
DATABASE_URL="postgresql://postgres:test@postgres:5432/db"
API_EXTERNAL_URL="http://localhost:9999"
GOTRUE_API_HOST="0.0.0.0"
PORT="9999"
GOTRUE_LOG_LEVEL=debug
Btw. it took me soo long to figure out that I need to put 0.0.0.0
for GOTRUE_API_HOST
instead of localhost
@BjoernRave , @gmisail
I had same issue, until I notice some configuration are not using PostgreSQL User postgres
but supabase_auth_admin
one.
For posterity, the fix the following DATABASE_URL: "postgres://postgres:postgres@db:5432/postgres?sslmode=disable&options=-csearch_path=auth"
Bug report
I am deploying
gotrue
using Docker Compose and I am having some trouble signing up. I initially used the hosted instance on Supabase and that worked fine, which is why I'm confused why this is causing me problems. It looks like when looking up identities on signup, it is ignoring the schema (DB_NAMESPACE
) that I have defined, causing the query to fail since the table does not exist.Describe the bug
We are currently trying to look up user identities in the
identities
table, however it is actually located inauth.identities
.Do these queries not respect the
DB_NAMESPACE=auth
environment variable that I have set? The migrations are clearly applied (as pictured in Screenshots) however it does not look like it's querying with this prefix in mind.To Reproduce
gotrue v2.99.0
& PostgreSQL using Docker Composeauth.signUp(...)
Expected behavior
To lookup the identities in
auth.identities
when creating a new user.Screenshots
System information
Additional context
Compose: