Changed an environment variable on Vercel but the live site still uses the old value
Trace an unchanged setting through the deployment, build output and cache. Follow the Vercel, Netlify or Replit checks before testing again.
Last edited October 31, 2026
On this page
Start by writing down the variable's name, the URL you tested and the deployment you expected to see. Keep its value out of screenshots and support messages. Work through one platform below, then verify the output before changing another setting.
Why the old value is still there
Build versus runtime: Vercel environment variables can be read during the build or during function execution. Vercel environment variables (opens in a new tab). Locate the code that reads your setting and identify which stage needs it; do not assume a dashboard edit has rebuilt the application.
Public browser values: Next.js replaces direct NEXT_PUBLIC_ references with values during the build, and those values remain frozen in the resulting bundle. Next.js environment variables (opens in a new tab). Vite also replaces import.meta.env constants at build time and exposes VITE_ values in client code. Vite environment variables (opens in a new tab). Rebuild when changing a public URL or feature flag used this way.
Deployment snapshots: Vercel applies environment-variable changes to new deployments, not previous ones. Vercel deployment behavior (opens in a new tab). Compare the edit time with the deployment time and check the exact deployment URL before investigating the custom domain.
CDN and browser cache: On Vercel, cache headers control browser and CDN freshness separately. Vercel cache controls (opens in a new tab). Inspect the response headers in the browser's Network panel; avoid blaming caching until you have checked which build the URL serves. Retest with browser caching disabled and compare the response with the deployment URL.
Deploy Without Errors Pack
Environment variables on Vercel, Netlify and Replit, SPA refresh rewrites, npm peer dependency errors and domain setup.
Secure checkout by Stripe
One-time payment through Stripe. Priced in USD. Local taxes such as UK VAT may be added at checkout.
Redeploy on Vercel
- Open the project's environment-variable settings and check the spelling of the key and the intended environment, such as Production or Preview. Use the Vercel environment-variable guide (opens in a new tab) to check environment selection.
- Save the correction, then create a new deployment for that environment. Treat the existing deployment as your before-state; do not expect it to inherit the edit. Vercel environment-variable guide (opens in a new tab).
- Open the resulting deployment directly. Repeat the specific action that used the old value and record the deployment identifier with your result.
Redeploy on Netlify
- Check both the deploy context and scope in the environment-variable settings. Netlify distinguishes Builds from Functions, and values can differ between Production and Deploy Previews. Netlify scopes and contexts (opens in a new tab).
- Include Builds for a value consumed by the build command; use the Functions scope for a serverless function's runtime setting. Netlify scope definitions (opens in a new tab).
- Save your edit and trigger a fresh build and deploy. Review the Netlify build-variable documentation (opens in a new tab) alongside the build log, then test the new deploy's URL before the main domain.
Republish on Replit
- Open the Secrets tool and correct the relevant key, using the Replit secrets instructions (opens in a new tab).
- Review Publishing → Adjust settings → Production app secrets for the published application, rather than checking only the editor's settings. Replit production secrets (opens in a new tab).
- Republish, wait for completion, and test the published URL. For a Static Deployment, do not plan on runtime secrets: Replit excludes that deployment type from secrets support. Replit secrets availability (opens in a new tab).
How to confirm
First, compare the deployment's environment and creation time with your dashboard change. Use a harmless public marker, such as a display label, when you need a visible test. Never print a private key to confirm that it exists.
Next, inspect the JavaScript files loaded by that deployment in browser developer tools. Search for the old and new public marker values, not credentials. For a downloaded build, search the output directory with your editor. Follow the reference from the HTML to its actual script file instead of searching an unrelated local checkout.
Finally, repeat the original user action on the main domain. Record the URL, build identifier and observed result. If the marker changed but the feature still fails, move on to that feature's request and error response instead of repeatedly editing the variable.
Related fixes
Tool to consider: Vercel.
Deploy Without Errors Pack
Environment variables on Vercel, Netlify and Replit, SPA refresh rewrites, npm peer dependency errors and domain setup.
Secure checkout by Stripe
One-time payment through Stripe. Priced in USD. Local taxes such as UK VAT may be added at checkout.