I’ve noticed that when we update environment variables, changes aren’t being reflected even after 12 hours of waiting. I have to manually go re-deploy the entire website which seems wrong. Am I missing some option for forcing a refresh pull of updated environment variables, or having a setting that let’s them immediately automatically update?
I’d expect changes to env vars to be live within some minutes. Would appreciate any help!
@akash-wellspring Netlify sites have a concept of “atomic deploys”:
There’s no “partially updated state”, so as I understand it triggering a deploy is how you “get things live”.
Atomic deploys for the actual software makes sense, but static environment variables partially defeats the purpose of environment variables - no? The software and environment variables are distinct entities, so changing environment variables via a config push wouldn’t violate the principle of atomic deploys. Live config pushes are a common feature of traditional cloud providers like AWS and gcp, but maybe I am misunderstanding the model here.
The documentation doesn’t seem to explicitly mention how environment variable updates are supposed to be handled.
Except that the environment variables are processed as part of the build, or in the case of a serverless function shipped as part of the deployment, I’m not sure where you’re proposing that they should be getting read from at runtime?
Got it. My (mis)understanding from the messaging around the “new” environment variables feature in Netlify was that they were set up as an entity that was being treated separately from my own deployed software. Meaning that I could essentially update them separately from my own software deploys via what would amount to a lightweight config push instead of a full deploy, thereby injecting new values for environment variables on the fly.
This is more of a replacement for what in the traditional “serverful” world would look like shipping a script for setting environment variables as part of my container deployment. Looks like I just read into it too much as being a much fancier live config push feature. Instead it is more of a convenience feature for setting environment variables before the rest of the software starts running. Coming from the traditional cloud world, this works more similarly to something like needing to deploy a new version of an AWS lambda function every time I want to update environment variables for it.
Thank you for the discussion Nathan!
P.S. If anyone from Netlify reads this, a nice convenience/UX improvement here would be having an option when editing an environment variable to automatically trigger a redeploy once I’ve saved the new value.
@akash-wellspring It may also be worth noting that the Environment Variables isn’t entirely a new feature.
Netlify has had the Environment Variables in the UI for a long time, what has seemingly been released recently is a changed UI and some additional functionality around setting environment variables for different situations, where previously you may have used your own string prefixes like LIVE-MY-KEY
, TEST-MY-KEY
to achieve it.