setup-cli icon indicating copy to clipboard operation
setup-cli copied to clipboard

Anon Key Not Found

Open whhsu2 opened this issue 2 months ago • 0 comments

Bug report

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

Describe the bug

The supabase link command fails with "Anon key not found" error in GitHub Actions, despite the API calls to retrieve project information and API keys succeeding. The access token is properly authenticated and the API endpoint GET /v1/projects/***/api-keys?reveal=true returns a successful response, but the CLI reports that the anon key is not found in the response.

To Reproduce

Steps to reproduce the behavior:

  1. Set up GitHub Actions workflow with the following environment variables:

    • SUPABASE_ACCESS_TOKEN (from Supabase account settings)
    • SUPABASE_DB_PASSWORD (database password)
    • SUPABASE_PROJECT_ID (project reference ID)
  2. Use the official supabase/setup-cli@v1 action:

- uses: supabase/setup-cli@v1
  with:
    version: latest
  1. Run the link command:
  • name: Link to Supabase dev project working-directory: ./backend run: supabase link --project-ref $SUPABASE_PROJECT_ID --debug
  1. Observe the error output

Expected behavior

The supabase link command should successfully retrieve the anon key from the API response and link to the project, allowing subsequent commands like supabase db push --dry-run to execute.

Screenshots

Debug output from GitHub Actions: Run supabase link --project-ref $SUPABASE_PROJECT_ID --debug shell: /usr/bin/bash -e {0} env: SUPABASE_ACCESS_TOKEN: *** SUPABASE_DB_PASSWORD: *** SUPABASE_PROJECT_ID: *** SUPABASE_INTERNAL_IMAGE_REGISTRY: ghcr.io open supabase/.temp/profile: no such file or directory Supabase CLI 2.58.5 Using profile: supabase (supabase.co) Loading project ref from flag: *** Using access token from env var... 2025/11/24 21:34:39 HTTP GET: https://api.supabase.com/v1/projects/*** 2025/11/24 21:34:39 HTTP GET: https://api.supabase.com/v1/projects/***/api-keys?reveal=true Anon key not found.

Additional context

  • Supabase CLI version: 2.58.5
  • Environment: GitHub Actions (ubuntu-latest runner)
  • Working directory: Contains a valid supabase/ directory with config.toml and migrations
  • Both API calls return HTTP 200 (successful), but the response apparently doesn't contain the anon key
  • The access token has proper permissions (can access project information)
  • There's also a warning about open supabase/.temp/profile: no such file or directory which may or may not be related

The issue appears to be that the API response from /v1/projects/***/api-keys?reveal=true either:

  1. Doesn't include the anon key in the response payload despite reveal=true
  2. The CLI is unable to parse the anon key from the response
  3. There's a permissions issue that's not being properly reported

whhsu2 avatar Nov 24 '25 22:11 whhsu2