Next.js Discord

Discord Forum

is changing an environment variable require redeployment?

Answered
Ghost ant posted this in #help-forum
Open in Discord
Avatar
Ghost antOP
Do I have to trigger deploy when changing/add an environment variable?
Answered by joulev
on vercel: yes
if you self-host via next start: yes if that's a NEXT_PUBLIC variable, likely no otherwise
View full answer

8 Replies

Avatar
on vercel: yes
if you self-host via next start: yes if that's a NEXT_PUBLIC variable, likely no otherwise
Answer
Avatar
but to be 100% sure, it's best to always redeploy on env var change if possible
Avatar
Ghost antOP
I have to redeploy
But when redeploying can I check the “use existing building cache” checkbox? Or the building cache doesn’t include the environment variables?
Avatar
yes
you can check the use existing cache
it's not related to env vars
though of course, if it somehows falls into some obscure edge case and your site still misbehaves, you can redeploy again with cache disabled. i doubt this can ever happen though