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

supabase link does not prioritize --password over .env file #3286

Closed
jonigata opened this issue Mar 12, 2025 · 1 comment · Fixed by #3295
Closed

supabase link does not prioritize --password over .env file #3286

jonigata opened this issue Mar 12, 2025 · 1 comment · Fixed by #3295

Comments

@jonigata
Copy link

Steps to Reproduce

  1. Create a .env file with the following content (invalid password):
  % cat .env
SUPABASE_DB_PASSWORD=xxxx
  1. Run the following command (valid password):
  % supabase link --project-ref ojjfemmmplnpzwdxwcwb --password password
  1. Observe that the --password argument is ignored, and the value from .env is used instead.

Expected Behavior

The .env file should not be used in this case. If it is considered, the --password argument should take precedence over .env.

Actual Behavior

The value from .env is used instead of the --password argument.

Additional Information

The following case works correctly:

  % SUPABASE_DB_PASSWORD=password supabase link --project-ref ojjfemmmplnpzwdxwcwb

This suggests that the current priority order is Environment Variable > .env > Command-Line Argument.

Additionally, it appears that other Supabase CLI commands also rely on the password stored in .env. As a result, if supabase link is executed using an environment variable like:

% SUPABASE_DB_PASSWORD=password supabase link --project-ref ojjfemmmplnpzwdxwcwb

then subsequent commands may require either setting the password via environment variables or writing it to .env. Given that link modifies the environment in a breaking way, it would be preferable for the password to be included as part of the new linked environment. Otherwise, users who manage multiple remotes would need to manually switch .env or environment variables each time they run supabase link, which can be cumbersome.

Environment

  • Supabase CLI version: 2.19.5
  • OS: Ubuntu22(WSL2)
@sweatybridge
Copy link
Contributor

sweatybridge commented Mar 15, 2025

This has been fixed in the beta release so --password flag takes precedence.

npx supabase@beta link --password test

Thank you for reporting the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants