Partly fixable yourself. Usually settings on your host and in the provider's dashboard.
- How serious
- Medium
- Fix it yourself?
- Partly, some steps need a developer
- Typical cost
- $49–$800 one-off check, or €99–$990 for a single fix (prices)
- Top rated
- Afterbuild Labs · 10.0/10
What you see. Payments, Google sign-in, email or an AI API work on localhost or in preview but error on the live domain.
Why it happens
Every integration has two halves. A secret on your side, and settings on the provider's side that name your URL. Both were set up for localhost or the preview URL, and the live domain was never added.
On your side, the local .env file is never uploaded. Production reads the host's environment variables instead. On Vercel each variable is ticked for Production, Preview or Development, and a change only reaches new deployments. On Netlify variables live under Project configuration, Environment variables, can have a different value per deploy context, and changes require a build and deploy to take effect. Values in netlify.toml override the UI. On the provider's side, Google redirect URIs, Stripe webhook endpoints and allowed domains still point at localhost. And test keys from development are often still in use. See variables undefined in production for the pure variable case.
Fix it yourself
- On the live site press F12 and find the failing request in Network. Error texts like redirect_uri_mismatch, invalid API key or 401 tell you which half is wrong.
- Vercel: open Settings, Environment Variables, and confirm every variable has Production ticked. Netlify: open Project configuration, Environment variables, and check the Production value and the Functions scope.
- Redeploy after any change. On both hosts existing deployments keep the old values.
- In each provider's dashboard add the live domain: redirect URIs for Google, webhook endpoint for Stripe, allowed origins for others. See redirect_uri_mismatch and paid but not upgraded.
- Use live keys in Production and test keys in Preview only. Never give a secret a
NEXT_PUBLIC_name to make it available, that ships it to the browser. - Write down every integration, its variable names, and the URLs registered with the provider. The next domain change will need the same list.
When to get an engineer
Get an engineer when several integrations fail at once, when the code reads variables under different names in different files, or when a secret may have been exposed in the process. Tell them the host, the failing integrations, and the error texts. A one-off check is $49–$800 and a single fix is €99–$990, about a day or two. Ask them to leave a list of every variable and where it is used.
Top-rated companies
Ranked by our score: published prices, scope of work, AI tools named, timing and a low-risk first step. How we score.
- 1Afterbuild Labs10.0/10Best for: A check before launchFree first step · from $49
- 2Redlab10.0/10Best for: A full rescue by one team that keeps buildingFree first step · from $490
- 3Vibe Code Rescue (Lev Arakelyan)9.0/10Best for: A one-off check and a cleanupFrom $299
Check these
Secrets live in the host's environment settings
Keys belong in environment variables on the server, not in the repository or in front-end code.
Testing and real users use separate databases
Experiments and AI agents should never run against production data.
Paid accounts are unlocked by a verified payment webhook
Access should change only when your server receives a signed webhook from Stripe or your provider, not when the browser reaches a success page.
Sign-up confirmation and password reset work end to end
Use a real inbox. Check that the link arrives, points to your live domain, and works once.
Questions
I added the variable, why does it still fail?
Changes apply to new deployments only. Trigger a redeploy, then check the variable is enabled for the Production environment and not just Preview.
Can I copy my .env file to the server?
On Vercel and Netlify there is no server to copy to. The values go into the host's environment settings, which is also where they stay out of your repository.
Sources: Vercel: environment variables; Netlify: get started with environment variables; Netlify: environment variables overview.
