From a009fe24ae71676d91ae053c4357cfef5b879b80 Mon Sep 17 00:00:00 2001 From: Amalanand Muthukumaran Date: Fri, 31 Jul 2026 11:40:57 -0700 Subject: [PATCH] fix(e2e): move roles.sql out of supabase/ so the CLI stops seeding it The Supabase CLI auto-seeds supabase/roles.sql as globals during 'supabase start'. On the current supabase/postgres 17.x images that seed connection is not a superuser, and supabase_auth_admin is a reserved role, so ALTER ROLE fails with SQLSTATE 42501 and kills the e2e job before Playwright runs. The file only exists for the docker-compose stack, where it runs as the init superuser via /docker-entrypoint-initdb.d. Move it to docker/db-init/ and update the compose mount; CI's 'supabase start' no longer sees it. Co-Authored-By: Claude Fable 5 --- docker-compose.yml | 2 +- {supabase => docker/db-init}/roles.sql | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) rename {supabase => docker/db-init}/roles.sql (70%) diff --git a/docker-compose.yml b/docker-compose.yml index fde092dd8..aebefe99d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,7 @@ services: JWT_EXP: 3600 volumes: - db_data:/var/lib/postgresql/data - - ./supabase/roles.sql:/docker-entrypoint-initdb.d/zz-roles.sql:ro + - ./docker/db-init/roles.sql:/docker-entrypoint-initdb.d/zz-roles.sql:ro healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 5s diff --git a/supabase/roles.sql b/docker/db-init/roles.sql similarity index 70% rename from supabase/roles.sql rename to docker/db-init/roles.sql index b70b422b9..e0db8a089 100644 --- a/supabase/roles.sql +++ b/docker/db-init/roles.sql @@ -1,6 +1,9 @@ -- Runs once on first DB init (after the supabase/postgres image creates its -- base roles). Guarantees GoTrue and PostgREST can log in with POSTGRES_PASSWORD. -- ponytail: only forces the two login passwords; everything else the image sets up. +-- Must NOT live under supabase/ — the Supabase CLI seeds supabase/roles.sql on +-- `supabase start` as a non-superuser, where altering supabase_auth_admin is +-- rejected as a reserved role (42501). Here it runs as the init superuser. do $$ begin if exists (select from pg_roles where rolname = 'supabase_auth_admin') then