---
title: "Integration works locally but fails in production"
description: "Integrations that work locally but fail live are missing production variables or still point at localhost at the provider. How to check both halves."
url: https://whocanfixmyapp.com/problems/integration-works-locally-fails-in-production
---

[Home](https://whocanfixmyapp.com/) / [Problems](https://whocanfixmyapp.com/problems) / [AI APIs and integrations](https://whocanfixmyapp.com/problems#ai-apis-and-integrations)

# Integration works locally but fails in production

VC-63 · Vercel · Netlify · Updated October 2026 · By [Nathaniel Kelley](https://whocanfixmyapp.com/authors/nathaniel-kelley)

Quick verdict

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](https://whocanfixmyapp.com/pricing))
- **Top rated**: [Afterbuild Labs](https://whocanfixmyapp.com/companies/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](https://whocanfixmyapp.com/problems/environment-variables-undefined-in-production) for the pure variable case.

## Fix it yourself

1. 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.
2. 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.
3. Redeploy after any change. On both hosts existing deployments keep the old values.
4. 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](https://whocanfixmyapp.com/problems/google-sign-in-redirect-uri-mismatch) and [paid but not upgraded](https://whocanfixmyapp.com/problems/stripe-webhook-not-firing-paid-but-not-upgraded).
5. 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.
6. 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](https://whocanfixmyapp.com/methodology#score).

- 1 · [Afterbuild Labs](https://whocanfixmyapp.com/companies/afterbuild-labs) · **10.0**/10 · Best for: A check before launch · Free first step · from $49
- 2 · [Redlab](https://whocanfixmyapp.com/companies/redlab) · **10.0**/10 · Best for: A full rescue by one team that keeps building · Free first step · from $490
- 3 · [Vibe Code Rescue (Lev Arakelyan)](https://whocanfixmyapp.com/companies/vibe-code-rescue-lev-arakelyan) · **9.0**/10 · Best for: A one-off check and a cleanup · From $299

[All 79 companies, ranked](https://whocanfixmyapp.com/directory#ranking)

## Check these

OPS-04 · Medium

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.

OPS-02 · High

Testing and real users use separate databases

Experiments and AI agents should never run against production data.

PAY-01 · Critical

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.

AUTH-01 · High

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](https://vercel.com/docs/environment-variables); [Netlify: get started with environment variables](https://docs.netlify.com/build/environment-variables/get-started/); [Netlify: environment variables overview](https://docs.netlify.com/build/environment-variables/overview/).

**Same category**

- [My OpenAI key was in the frontend and I got a surprise bill](https://whocanfixmyapp.com/problems/openai-key-in-the-frontend-surprise-bill)
- [OpenAI 429 rate limit errors in my app](https://whocanfixmyapp.com/problems/openai-429-rate-limit-errors)
- [AI API costs are spiking](https://whocanfixmyapp.com/problems/ai-api-costs-are-spiking)
- [Serverless or edge function timed out](https://whocanfixmyapp.com/problems/serverless-or-edge-function-timeout)
- [Transactional emails not sending from my app](https://whocanfixmyapp.com/problems/transactional-emails-not-sending)

[All ai apis and integrations problems](https://whocanfixmyapp.com/problems#ai-apis-and-integrations)

**Run every check**

The [production checklist](https://whocanfixmyapp.com/checklist) has all 24 checks with a verdict.
