NEXT_PUBLIC variable is undefined in the browser
Public variables are inlined during the build, so they must exist before it runs, and your Dockerfile build step must mount the appenv secret.
Last updated November 25, 2026
The error
process.env.NEXT_PUBLIC_API_URL is undefined in the browser
Why it happens
Public variables are inlined during the build, so they must exist before it runs, and your Dockerfile build step must mount the appenv secret.
How to fix it
Set the variable, check that the build step mounts the secret, then rebuild.
ezhst env set NEXT_PUBLIC_API_URL=https://api.example.com ezhst redeploy
Still stuck
Read the build log and runtime logs, or browse all errors.
Start for free
Install the skill, choose Global or Local, then tell your agent to deploy. No credit card, no config files.
$npx ezhst skill install