cli: Getting error "relation "pgsodium.key_key_id_seq" does not exist (SQLSTATE 42P01)" when using "db remote commit"
Bug report
Describe the bug
When using the latest CLI to init, start, link, and remote commit; supabase errors with a missing relation.
relation "pgsodium.key_key_id_seq" does not exist (SQLSTATE 42P01)
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
supabase initsupabase startsupabase link --project ...supabase db remote commitsupabase db reset
PS C:\Users\silen\Documents\GitHub\buildr-monorepo> supabase db reset
Resetting database...
Initialising schema...
Applying migration 20220824061131_remote_commit.sql...
Error: ERROR: relation "pgsodium.key_key_id_seq" does not exist (SQLSTATE 42P01)
Expected behavior
The database should now reflect the migration.
System information
- OS: Windows 11
- Version of supabase-cli: 1.1.5
- Version of Node.js: 16.13.2
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 16
- Comments: 24 (6 by maintainers)
I’m hitting the same issue as @fbinz on a fresh project after
supabase db remote commit. The hosted database seems to usepgsodiumversion3.1.5whereas the CLI (version1.29.1) sets up version3.0.4(according topg_catalog.pg_extension).Fixed it;
https://github.com/supabase/cli/issues/246
supabase link --project-ref <project-id>supabase db remote commitsupabase db resetpgsodium.key_key_id_seq does not exist20220913230812_remote_commit.sqlfile - comment everything out, save without formatting.sqlfile over atsupabase/extensions.sqland put in whichever extension is failing youCREATE EXTENSION pgsodium SCHEMA extensions;in this casesupabase db resetand it should worksupabase db pushto the remote, you’ll see the timestamp is differentsupabase_migrations.schema_migrations- copy the one row in there (if you have multiple, it should be the first)migrationsfoldersupabase db pushAnd you’re good to go. Verified that this works even when I add new tables and
supabase db reset.Hope this saves someone the absolutely agonizing experience of googling
relation "pgsodium.key_key_id_seq" does not exist (SQLSTATE 42P01)No progress. I still don’t understand why this happens. It’s very annoying and I’m completely unable to sync my local to my remote.
Had this error locally when undergoing a major postgres upgrade (14 -> 15) and trying to run supabase reset.
Stopping and restarting supabase helped to force supabase cli to upgrade the used docker images