supavisor
supavisor copied to clipboard
Supavisor insufficient privileges on schema _supavisor
Bug report
- [x] I confirm this is a bug with Supabase, not with my own application.
- [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
I'm self hosting supabase with the latest master branch. I've setup all the env variables and followed the self host tutorial. However all containers spin up apart from the supavisor. On checking the logs, it throws an Ecto migrator error.
Logs
Setting RLIMIT_NOFILE to 100000
15:55:17.424 [error] Could not create schema migrations table. This error usually happens due to the following:
* The database does not exist
* The "schema_migrations" table, which Ecto uses for managing
migrations, was defined by another library
* There is a deadlock while migrating (such as using concurrent
indexes with a migration_lock)
To fix the first issue, run "mix ecto.create" for the desired MIX_ENV.
To address the second, you can run "mix ecto.drop" followed by
"mix ecto.create", both for the desired MIX_ENV. Alternatively you may
configure Ecto to use another table and/or repository for managing
migrations:
config :supavisor, Supavisor.Repo,
migration_source: "some_other_table_for_schema_migrations",
migration_repo: AnotherRepoForSchemaMigrations
The full error report is shown below.
** (Postgrex.Error) ERROR 42501 (insufficient_privilege) permission denied for schema _supavisor
(ecto_sql 3.10.2) lib/ecto/adapters/sql.ex:1047: Ecto.Adapters.SQL.raise_sql_call_error/1
(elixir 1.14.3) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(ecto_sql 3.10.2) lib/ecto/adapters/sql.ex:1154: Ecto.Adapters.SQL.execute_ddl/4
(ecto_sql 3.10.2) lib/ecto/migrator.ex:756: Ecto.Migrator.verbose_schema_migration/3
(ecto_sql 3.10.2) lib/ecto/migrator.ex:564: Ecto.Migrator.lock_for_migrations/4
(ecto_sql 3.10.2) lib/ecto/migrator.ex:433: Ecto.Migrator.run/4
(ecto_sql 3.10.2) lib/ecto/migrator.ex:170: Ecto.Migrator.with_repo/3
nofile:1: (file)
I've tried granting all permissions to this schema by adding this code to the pooler.sql file
GRANT ALL PRIVILEGES ON SCHEMA _supavisor TO :pguser;
System information
- OS: [14.6.1]
- supavisor: [supabase/supavisor:1.1.62]
- database: [supabase/postgres:15.8.1.003]