Skip to content

[Bug]: Local anon key persists after full reset, causing persistent "Invalid JWT" errors #4042

@shine83

Description

@shine83

Hello Supabase Team,

Describe the bug

The local development server (supabase start) consistently generates the same anon key even after a full reset using supabase stop --no-backup, and even after a complete docker system prune -a --volumes.

This stale key is not valid for the local API gateway, causing all requests to Edge Functions to fail with an {"msg":"Invalid JWT"} error. This makes local testing of Edge Functions completely impossible.

To Reproduce

Run supabase start in a project. Note the outputted anon key.

Run supabase stop --no-backup to stop the server and remove the database.

(We also tried a more drastic reset) Run docker system prune -a --volumes and restart Docker Desktop.

Run supabase start again.

Observe that the "new" anon key printed to the console is identical to the key from step 1.

Attempt to call any Edge Function using this key via curl. The request fails with {"msg":"Invalid JWT"}.

Expected behavior

After a full reset (supabase stop --no-backup or a Docker prune), supabase start should generate a completely new and valid anon key that is accepted by the local API gateway.

System information

OS: macOS (Apple Silicon)

Supabase CLI version: [2.34.3]
Additional context

This issue seems to be caused by the JWT secret not being properly reset for the local services, making local development impossible. Thank you for looking into this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions