cli: GitHub Workflow Failing: Supabase pgsodium Schema Missing on >= 2.20.4
Describe the bug it seems to me that the supabase setup tried to create the pgsodium extension before the schema.
842fd6281a5f: Pull complete
Digest: sha256:0cfa54e096dcae4ed30162811fa8794f7c443708c41973329e07f7d44c1cc3e7
Status: Downloaded newer image for ghcr.io/supabase/gotrue:v2.170.0
Seeding globals from roles.sql...
Applying migration 20241104023929_roles.sql...
Applying migration 20241104023930_init_dump.sql...
Stopping containers...
ERROR: schema "pgsodium" does not exist (SQLSTATE 3F000)
At statement 11:
CREATE EXTENSION IF NOT EXISTS "pgsodium" WITH SCHEMA "pgsodium"
Try rerunning the command with --debug to troubleshoot the error.
Error: Process completed with exit code 1.
Additional context this issue only occurs on >= 2.20.4
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 32
- Comments: 21 (7 by maintainers)
Commits related to this issue
- Fix: Removed pgsodium extensikon from migration file, since the extention cannot be installed anymore after supabase has updated postgres to 15.8.1.060, please take a look at this discussion: https://... — committed to JorSoi/FriendsCodes-New by JorSoi 2 years ago
- Comment out pgsodium due to supabase/cli/issues/3358 — committed to hivecom/hivecom.net by zealsprince a year ago
- rm pgsodium entry - because of update https://github.com/supabase/cli/issues/3358#issuecomment-2755803583 — committed to matus-barta/Open_RMM by matus-barta a year ago
- Workaround https://github.com/supabase/cli/issues/3358 — committed to munrocket/compute.toys by davidar a year ago
- Workaround https://github.com/supabase/cli/issues/3358 — committed to munrocket/compute.toys by davidar a year ago
It’s because we updated postgres to 15.8.1.060 which removed the pgsodium schema by default.
As mentioned in the error message, the statement 11 of your
supabase/migrations/20241104023930_init_dump.sqlfile is creating the pgsodium extension. This no longer works in latest postgres image because the pgsodium schema is no longer present.You can fix the error by deleting or commenting out this line.
Since you’ve fixed the migrations locally and CI, the remote migration history table is now outdated. You can bring them back in sync by running
supabase migration repaircommand. This only updates the history table without actually running any migrations.How will the upgrade work? We’re pretty dependent on
pgsodiumat the moment, using it for dispatching webhooks with standard webhook signatures like how the custom auth hook does it.Yes, it is at the moment, but it’s an implementation detail of vault that we plan to change.
When you install vault with cascade, it will install the dependencies it needs, including pgsodium in this case. So either way, it’s unnecessary to create pgsodium extension separately.
I am now facing this issue again:
I pulled a fresh seed file from my remote database, everything was working as expected while developing locally, but as I tried to apply my migrations through CI things are broken again.
I have identified the root cause to be from this part of the
seed.sqlfile:@sweatybridge How can you ask us to remove pgsodium schema from our migrations, but then still keep it around to break things later down the road?
@sweatybridge I am facing the same issue currently. I tried removing all pgsodium related lines in my migrations, which works locally, but still fails in my CI. How would I go about removing this from my staging and production migrations which are now broken?
When I go the Database Migrations page in the Supabase dashboard I can see that pgsodium is still present in my migration, but it is not clear to me how I can change migrations that have already been run and have now broken.
This is indeed a problem that we need to address with pgsodium deprecation. I’ve looped in the postgres team to take a closer look. cc @soedirgo
@sweatybridge isn’t the vault using pgsodium by default?
It’s more complicated in this case because we plan to sunset the pgsodium schema on the managed platform soon. So IMO it’s better to future proof your migrations by deleting this line.
We’ve made sure that new migrations from db dump no longer rely on this schema but unfortunately we can’t easily fix older migrations that live inside your repo. So sorry that you have to find out this way. May be there’s a better alternative that we are not aware of.