Browser or terminal

Error: Secret API key must not use the NEXT_PUBLIC_ prefix

What it means
A secret key was named with `NEXT_PUBLIC_`, which sends its value to every visitor's browser.
Likely causes
  • Adding NEXT_PUBLIC_ to an API key or auth secret so client code could read it.
  • Calling an AI provider or database from a 'use client' component instead of the server.
Prevention
Golden rule: nothing secret ever starts with NEXT_PUBLIC_. Keep keys server-only.

Copy for your agent

A secret variable used `NEXT_PUBLIC_`. Move the code that uses it to the server, rename the variable without `NEXT_PUBLIC_`, and I will revoke and replace the exposed key.

Full help articleYou committed a secret: revoke, replace, clean up

Last reviewed Nov 8, 2026