1. EasyHost
  2. Errors
  3. NEXT_PUBLIC variable is undefined in the browser

NEXT_PUBLIC variable is undefined in the browser

Public variables are inlined during the build, so they must exist before it runs.

Last updated November 9, 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.

How to fix it

Set the variable, then rebuild. Changing it later also requires a 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