© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•2mo ago•
3 replies
Frugal Bandit

Can't rotate to new API keys - JS client fails when legacy keys disabled

auth
Hey everyone, need some help with API key rotation.

Problem: My service_role key was accidentally exposed in a git push. I need to rotate to new keys ASAP.

What I tried:
1. Created new
sb_publishable_
sb_publishable_
and
sb_secret_
sb_secret_
keys in dashboard
2. Updated all my configs (Next.js app, Node.js server, Cloudflare Worker)
3. Tested - everything worked while legacy keys were still enabled
4. Disabled legacy anon/service_role keys

Result: All API calls fail with "Legacy API keys are disabled"

My setup:
- @supabase/supabase-js v2.88.0 (Next.js)
- @supabase/supabase-js v2.39.0 (Node server)
- Cloudflare Worker using fetch() with apikey header

I also tried rotating the JWT signing key, but the legacy key VALUES stayed the same - only the signing mechanism changed. Doesn't help when the key itself is leaked.

According to docs, the new keys should be drop-in replacements. But the JS client doesn't seem to work when legacy keys are disabled.
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Legacy api keys used even if disabled?
SupabaseSSupabase / help-and-questions
4mo ago
Get Typescript Types from Management API with Legacy Keys Disabled?
SupabaseSSupabase / help-and-questions
2mo ago
New Publishable API Keys vs. Legacy Anon Key
SupabaseSSupabase / help-and-questions
6mo ago
How to automatically create API keys (non-legacy) for new branches
SupabaseSSupabase / help-and-questions
4mo ago