cli: Error on 'npx supabase start' When Linking New Local Project to Existing Remote Supabase Project
Describe the bug
When running npx supabase start in a new local project and attempting to link to an existing Supabase project, the process fails with the error: “Migration failed. Reason: An error occurred running ‘storage-schema’”. This is particularly interesting because I don’t have any migrations in my project.
To Reproduce Steps to reproduce the behavior:
- Initialize a fresh Supabase folder by running
npx supabase init. - Log in to your Supabase account by running
npx supabase login. - Link your remote Supabase project by executing
npx supabase link --project-ref PROJECT_REF. - Enter your database password.
- Run
npx supabase start. - Observe the error as shown in the screenshot.
Expected behavior I expect that all containers would successfully run, allowing me access to the local Supabase Studio.
Screenshots Screenshot of error Project Structure
Desktop:
- OS: MacOS 14.0 (23A344)
- Docker Client: OrbStack
- Version of CLI: 1.136.2
- Version of Node.js: v18.17.0
Additional context
I’ve successfully run npx supabase start in another project I am working on, which makes it surprising that this issue occurs in a fresh project that I am trying to link to an existing remote Supabase project.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 6
- Comments: 19 (6 by maintainers)
I can confirm there is an incompatibility with the latest version of storage which starts managing roles in a non-idempotent way https://github.com/supabase/storage/blame/master/migrations/tenant/0002-storage-schema.sql#L21.
The temporary workaround is to revert to an old version of storage by
rm supabase/.temp/storage-version.I will also make a patch release after discussing with the storage team on what’s the intended behaviour.
Hello mine worked after doing these steps
just did supabase link before doing supabase start
I have the same issue, with or without migrations present, even on a clean project with no prior configuration. Supabase CLI v1.137.0 (beta) is also affected.
Supabase Services:
A note about the
supabase/postgresversion: this is due to my remote running still this version (haven’t upgraded), tut this happens with the latest version as well.That’s a separate error tracked here https://github.com/supabase/cli/issues/1892
Great! That did the trick for me, even without upgrading the remote Postgres version. I’ll do that later. Thanks so much for your quick actions, @sweatybridge!
So the earliest version of pg15 that is compatible with cli for local development is
15.1.0.55. I’ve updated the beta release of cli to ignore versions before that. You can try it out withThere’s likely a conflict with this version of postgres image with realtime migrations. One way to fix it is to delete
supabase/.temp/postgres-versionfile so it uses the latest pinned version. I will also make a patch to cli to ignore these incompatible versions.Alternatively you may want to update your hosted project to the latest postgres version.
Hey, @sweatybridge! Thanks for figuring it out. It seems to have solved the specific error I mentioned earlier. However, I’m now encountering a new error. After removing the .temp folder, re-linking with my remote project, and running
npx supabase startagain, this issue surfaced. I did update to CLI version 1.136.3.New error log:
Output of
npx supabase services: