cli icon indicating copy to clipboard operation
cli copied to clipboard

CLI link command fails with "necessary privileges" error for Project Owner

Open walisonanjos opened this issue 5 months ago • 5 comments

Hello Supabase Team,

I'm encountering a persistent "privileges" error when trying to run npx supabase link for my project, even though I am the confirmed Owner of the project.

Describe the bug When running npx supabase link --project-ref nbqmhhbiollijnjnktpl, the command fails with the error: Your account does not have the necessary privileges to access this endpoint.

To Reproduce Steps to reproduce the behavior:

In a Gitpod environment, install the Supabase CLI: npm install supabase --save-dev Log in via the CLI: npx supabase login (this requires manual authentication via browser URL, as xdg-open is not available). Login is successful. Run the link command: npx supabase link --project-ref nbqmhhbiollijnjnktpl The command fails with the privileges error. Expected behavior The link command should successfully connect the local environment to the remote Supabase project after asking for the database password.

Screenshots I have screenshots confirming:

My user role is Owner in the project settings. The exact error message in the terminal after running the command. The error persists even after trying a npx supabase logout / login cycle. The error also persists when using a manually generated Access Token via SUPABASE_ACCESS_TOKEN=... npx supabase link. System information

OS: Linux (via Gitpod) Supabase CLI version: 2.24.3 Supabase Project Ref: nbqmhhbiollijnjnktpl Additional context I noticed there is an active incident on the Supabase status page related to "Sign in with Apple". While my login is via GitHub, I suspect this underlying auth instability might be related to the issue.

Thank you for your help!

Image Image

walisonanjos avatar Jun 11 '25 13:06 walisonanjos

Hi, I've moved this issue over from the supabase repo.

Hallidayo avatar Jun 11 '25 16:06 Hallidayo

Same issue Unable to restart project: Your account does not have the necessary privileges to access this endpoint

zouspants123321 avatar Jun 12 '25 18:06 zouspants123321

Same issue here with Administrator role: Unexpected error retrieving remote project status: {"message":"Your account does not have the necessary privileges to access this endpoint. For more details, refer to our documentation https://supabase.com/docs/guides/platform/access-control"}

rmateusc avatar Jun 18 '25 15:06 rmateusc

I'm having a problem that might be related. I get the same "Your account does not have the necessary privileges" error when trying to deploy functions.

Then, when I run supabase projects list I do get my list of projects but I also see a message: Cannot find project ref. Have you run supabase link?

So... I run supabase link --project-ref mxxxq --debug and I get the error again... so I seem to be stuck.

That said, I was able to get supabase link --project-ref... working before, even earlier today, so not sure why it's not honoring the link.

Anyways, saw this was recent so thought I would mention it. I was deploying functions last week just fine on a different account / different project but with the same CLI. When I first encountered this error I also updated the CLI but still having the issue.

brainwavecoder9 avatar Jun 20 '25 01:06 brainwavecoder9

What worked for me...

I went to account tokens to create a dedicated token and set SUPABASE_PROJECT_REF and SUPABASE_ACCESS_TOKEN environment variables. I then re-ran supabase link... which asked for my database password that I entered at the command line (it's my understanding this can also be set as an environment variable).

After that it recognized the link and my other commands worked again.

Again, no idea if related, but thought I'd pass it along.

tl;dr - it seems like something related to login isn't being honored for project level work, but re-authenticating at the project level did the trick

brainwavecoder9 avatar Jun 20 '25 02:06 brainwavecoder9