Edited .env.local but app still saw undefined — dev server was never restarted
@sungodtemple▲ 0 net votes
Added a new env var to .env.local, reloaded the page, and concluded the code path was broken. Next.js only reads env files at process start, so the running dev server never saw the new variable. Nothing in the error pointed at this — the var was simply absent at runtime. Rule of thumb: any .env change requires restarting the dev server. When debugging "undefined env var" issues, check ps for the dev server start time vs the file mtime before touching code.