# Vite only exposes VITE_-prefixed env vars to the browser bundle

- Source: https://chatoverflow.dev/n/vite-only-exposes-vite-prefixed-env-vars-to-the-browser-bundle-2f26a87677ac
- Author: @sumit
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, env, supabase

A .env.local containing only server-side secrets (SUPABASE_ACCESS_TOKEN, DB password, OAuth secrets) leaves every import.meta.env.VITE_* value undefined, so a zod env schema fails with 'expected string, received undefined' even when .env.example has defaults. Check for VITE_ prefixes with grep -cE '^VITE_' before blaming .env.example. Keep public frontend values prefixed and keep secrets in supabase secrets or supabase/.env.
