I have a sensitive env var defined in the project in the dashboard, but when I pull the env locally to use with vercel dev, the sensitive vars dont get pulled (which makes sense, bc to make them sensitive they cant apply to the dev env). So then I add them to the local env file, but they’re not being read locally by vercel dev.
add sensitive env var to project in UI
pull env file locally (either .env.local or .vercel/.env.development.local)
Add sensitive vars to pulled file
run vercel dev
expect to be able to use sensitive env vars, but cant
Private, simple setup with VITE and Vercel Serverless functions using nodejs runtime.
If I delete the sensitive env vars, and re add them as non sensitive, and add them to the dev env, and re pull the env var files, it works. but that defeats he purpose of the sensitive env vars right? What’s the right way to handle sensitive env vars when running vercel dev locally?
Hey @otterbudget-gmailcom. Sensitive environment variables are non-readable after they’re created. As you already mentioned, they are only usable for Production and Preview environments and don’t apply to the dev environment. But you can add a normal variable with the same name to be used for development. Please give that a try and let me know if you run into any more trouble with it.