The Prompt BakeryTemplates and prompts

Fix · Supabase and databases

Wrong key: anon key versus service role key

Blocks your workSecurity

What you may see

  • I am not sure which Supabase key goes where
  • Everything works with the service key but not with the other

Most likely cause

The public key (anon or "publishable") is made for the browser and obeys the security rules; the service role (or "secret") key ignores them and must stay on the server only.

Check first (about two minutes)

  1. Search the project for the word service_role and for where the secret key is read.
  2. Check no variable with a public prefix holds the service key.

The fix prompt

What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.

Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.

Prompt language

Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.

After you tried it, did it work?

Steps

  1. List where each Supabase key is used in the code (names of variables only), and whether that code runs in the browser or on the server.
  2. Make the browser code use only the public key, and keep the secret key in server-only code and server-only variables.
  3. If the service key was ever in browser code or in Git, tell me to create a new one and revoke the old (see the leaked key entries).

Do not do this

  • Do not paste either key into chat.
  • Do not make the app work by switching to the service key in the browser.

Related

Try another entry

How can we help?

What do you need?
Your email, so we can reply (optional)Only enter your own email. We reply there.