EthioDeploy blog
FIX DEPLOY ERRORS · OCT 29
Vite env variables undefined in production: causes and fixes
A Vite env variable is undefined in production when the build never saw it. Vite replaces every import.meta.env.VITE_ reference with a fixed value while vite build runs, so a variable added to your server afterwards changes nothing until you build again. The other common causes are a name without the VITE_ prefix and code that reads process.env in the browser.