Skip to content

postgres supabase_admin user not created in initial setup #1520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pweibert opened this issue Apr 3, 2025 · 3 comments
Open

postgres supabase_admin user not created in initial setup #1520

pweibert opened this issue Apr 3, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@pweibert
Copy link

pweibert commented Apr 3, 2025

  • [ x] I confirm this is a bug with Supabase, not with my own application.
  • [ x] I confirm I have searched the [Docs]

Describe the bug

After upgrading db container to 15.8.1.020 database won't startup correctly complaining that supabase_adming role does not exist.

db starts up correctly with container 15.1.1.78

To Reproduce

  1. Delete all postgres database files
  2. change db container to 15.8.1.020 & startup your system

System information

I use the container in a kubernetes setup but it looks like a general problem with migrations/db/init-scripts/00000000000000-initial-schema.sql in the most recent commit
ab7f879

the line create user supabase_admin dissapeared (it was present before).

Additional context

This seems to be related to 18836

@pweibert pweibert added the bug Something isn't working label Apr 3, 2025
@albinabc
Copy link

albinabc commented Apr 8, 2025

Image

I'm getting something similar while trying to use the migrate script to prepare my database for supabase. I've tried adding:

create user supabase_admin;
alter user supabase_admin password 'my_password';
alter user  supabase_admin with superuser createdb createrole replication bypassrls;

And the 'my_password' is just the password I'm using for my local postgres superuser, which I've set in the .env as POSTGRES_PASSWORD.

But does not make a difference. I'm doing this from scratch. Have just created a "supabase" database which I've set the POSTGRES_DB to.

@albinabc
Copy link

albinabc commented Apr 9, 2025

To not mess with the local postgres user, I commented out the

ALTER ROLE postgres NOSUPERUSER CREATEDB CREATEROLE LOGIN REPLICATION BYPASSRLS;

I instead added a supabase_admin as a superuser, and settled for running against the "postgres" database. I wanted to run on a different one, but I see that the postgres database is hard-coded in the migrate-script, instead of being taken from the envs, in the line alter database postgres owner to postgres. So I wanted to try running that first, and I figure I'll sort it out later if I get it working this way.

But the issue is now instead

./migrate.sh: running /Users/albin/Programmering/postgres/migrations/db/migrations/20250220051611_
pg_net_perms_fix.sql
CREATE FUNCTION
DO
./migrate.sh: running /Users/albin/Programmering/postgres/migrations/db/migrations/20250312095419_
pgbouncer_ownership.sql
psql:/Users/albin/Programmering/postgres/migrations/db/migrations/20250312095419_pgbouncer_ownersh
ip.sql:2: ERROR:  schema "pgbouncer" does not exist

I've recently reset my database. I'll keep working at it and see if I can find some workaround. I tried adding the schema manually but then when running the supabase docker compose I'm back to that the analytics can't connect to the postgres, and since everything depends on the analytics being up, nothing works.

@albinabc
Copy link

albinabc commented Apr 9, 2025

I think the reason for the analytics failing might be due to the fact that there's no _analytics schema in the database, and I can't find anywhere in the migrations that such a schema would be created either. The only place I can find the _analytics schema being referenced is in logs.sql in the supabase docker folder.

And there, I can only see it being used in the docker-compose setup when spinning up the supabase/postgres, and I'm not sure if there's some kind of flow/script to run this for an external database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants