β All fixes
Ship failure
ENV vars work locally, not in production
The fix
Three gotchas: (1) `NEXT_PUBLIC_` prefix required for vars used in client code. (2) Vercel preview and production are separate scopes β set the var in both. (3) Server actions don't re-read env at runtime if hot-reloaded weirdly; redeploy clean. Always `vercel env pull` and check the .env.local matches what you expect.
Deeper dive: read the full article β