Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "Invalid project ref format" error message when trying to run npx supabase db push #2915

Open
2 tasks done
bactrachdam opened this issue Nov 24, 2024 · 8 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@bactrachdam
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

I have a Supabase project and want to run some migrations that I have written against the managed instances. Here are the commands I ran:

npx supabase --version # --> 1.223.10
npx supabase login # --> login via browser
npx supabase link --project-ref <PROJECT_REF> # --> Project Ref I got from Supabase Dashboard
npx supabase db push # --> Invalid project ref format. Must be like `abcdefghijklmnopqrst`.
npx supabase db push --debug # --> WARN: no SMS provider is enabled. Disabling phone login. Invalid project ref format. Must be like `abcdefghijklmnopqrst`.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. You can either use an existing Supabase project to create a new one with npx supabase init
  2. Create a simple migration file
  3. Run the following commands
npx supabase login # --> login via browser
npx supabase link --project-ref <PROJECT_REF> # --> Project Ref from Supabase Dashboard
npx supabase db push

Expected behavior

I expect the migration to run successfully. This has been working fine until the most recent upgrade to Supabase CLI. I haven't changed any configuration on my MacBook Pro M3.

Screenshots

Screenshot 2024-11-25 at 10 02 59 am

System information

  • OS: MacOS
  • Version of supabase-js: 2.45.1
  • Version of Node.js: 18.18.0
  • Supabase CLI: 1.223.10
@bactrachdam bactrachdam added the bug Something isn't working label Nov 24, 2024
@automationconsulting
Copy link

I can confirm that there is a bug with the latest version. In fact I have to go back all the way to v1.219.2.

npx [email protected] db push                                
WARN: no SMS provider is enabled. Disabling phone login
Connecting to remote database...
Remote database is up to date.
A new version of Supabase CLI is available: v1.223.10 (currently installed v1.219.2)
We recommend updating regularly for new features and bug fixes: https://supabase.com/docs/guides/cli/getting-started#updating-the-supabase-cli

@charislam charislam transferred this issue from supabase/supabase Nov 25, 2024
@avallete
Copy link
Member

Hey @bactrachdam @automationconsulting I couldn't reproduce on my end. Could you confirm that your project-ref look like this:

aqwrkqrrliwmplmswjxi

Also could you check if you might have set an SUPABASE_PROJECT_ID in your environment ?

@tillka
Copy link

tillka commented Dec 6, 2024

I found this by googling an error a client of mine is facing.
He has the same issue when generating types via the cli.
I can confirm that the project id is 20 characters long and taken directly from supabase.

@avallete
Copy link
Member

avallete commented Dec 6, 2024

@tillka @automationconsulting @bactrachdam

Hey there, thank's for reporting. There is not much we can do without the actual project ref to reproduce. I recommend opening a support ticket on the project that has the issue: https://supabase.com/dashboard/support/new

That way we'll be able to fully investigate why this happens on those specific projects.

@bactrachdam
Copy link
Author

Hey @avallete

Thanks for your patience. I've been using the work around of using version 1.219.2, e.g., npx [email protected] link --project-ref zcueounpgcpchreuvcrr. This here is the actual project reference for one of the projects I manage. In saying so, it doesn't matter which project reference I use with the latest Supabase CLI version. They all tell me the project references are all in invalid format.

Hope that helps you with your investigation. Reading further into this issue online, it looks like I am not the only one experience this problem.

CC: @tillka

@tillka
Copy link

tillka commented Dec 9, 2024

Hi all,

I used to put the project-id in single quotes as in --project-ref 'zcueounpgcpchreuvcrr'. The newest version of the Supabase CLI does not seem to accept the single quotes anymore. So, the fix for my client was simply to remove them.

As I still run an older version of Supabase CLI the single quotes version still works for me - so there definitely have been some changes in how the cli reads the project-ref.

@avallete
Copy link
Member

avallete commented Dec 9, 2024

Hey @tillka @bactrachdam,

We recently fixed an issue with project-ref loading that might have allowed environment variables to override the flag set via the command line. This could have been the cause of the troubles you encountered: #2952

Could you please try again using the beta release channel (npx supabase@beta) to access the latest build with this fix? Let us know if it resolves the issue.

@stephenmmcleod
Copy link

stephenmmcleod commented Dec 11, 2024

I can confirm that I also have this error using the latest beta up to 2.0.10, reverting to 1.219.2 fixed it for me but would be nice to be able to update. I also get the project-ref error on db pull and other commands like migration list. If it helps any, I'm on windows 10 using wsl2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants