cli icon indicating copy to clipboard operation
cli copied to clipboard

Expose Preview Branch anon key via CLI

Open Thorsten-Kd opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. We're creating preview branches for development through a script on the command line. I am able to retrieve all the preview branch details, like the jwt secret, but I am not able to retrieve the anon key via the CLI. We need the anon key to spin up a development server

Describe the solution you'd like Ideally I would like to use a command like supabase branches get-api-keys <branch_id> that returns the api keys that we can use to spin up a development server.

Describe alternatives you've considered I tried using the jwt secret returned by supabase branches get <branch_id> to create an anon key, but I wasn't able to create a working anon key even though I followed the directions here and was able to create a similar anon key than the one that is exposed on the dashboard: https://stackoverflow.com/questions/74587078/any-way-to-generate-supabase-anon-key-and-jwt-secret-locally

Additional context We need this to be automated and can't copy the anon key manually from the preview branch dashboard.

Thorsten-Kd avatar Jan 30 '25 21:01 Thorsten-Kd

I'm running in to this because I had hoped the Supabase GitHub integration would be smart enough to sync the public url and anon key to the Vercel deployment associated with the Supabase branch created for the GitHub pull request. I was looking for a way I could hack it together myself, but because we are unable to programatically retrieve the public url and anon key, it appears to be impossible to automate.

edit:

after hacking at it for a while, I have Supabase branches and Vercel deployments playing nice together and syncing the appropriate secrets (via the official integrations), but I'll have to examine what exactly I did to get it working. If anyone is interested feel free to ask and I'll see if I can wrangle up some instructions.

cwharris avatar Nov 25 '25 22:11 cwharris