Skip to content
NEZ®

Production · · 2 min read

The staging environment is lying to you

NEZ Engineering

Essay cover: The staging environment is lying to you

Every team has lived this sequence. The feature works locally. It works in staging. It ships, and within an hour production is paging. The instinct is to blame the deploy, but the deploy was fine. The problem is that staging was never telling you the truth in the first place.

Staging lies for boring, structural reasons.

The data is the wrong shape. Staging databases are small, clean, and recent. Production data is old, huge, and weird. It has null fields from a migration two years ago, names with characters your formatter has never met, and one customer whose account is a thousand times larger than the median. Most “worked in staging” incidents are data-shape incidents.

The traffic is polite. One tester clicking through a flow is not fifty users hitting the same endpoint during a retry storm. Race conditions, lock contention, and connection pool exhaustion simply do not exist at staging traffic levels, so staging cannot catch them.

The third parties are on their best behavior. Sandbox payment gateways approve everything instantly. Production gateways time out, rate limit, and return undocumented error codes on the last day of the month. If your integration has only met the sandbox, it has not met the vendor.

The configuration drifted. Staging quietly runs different environment variables, a different instance size, an older extension version. Nobody audits this until an incident forces them to.

So we treat staging as a smoke test, not a verdict. Before a launch, the checks that actually predict production look like this:

  1. Run the migration against a copy of the production database and time it. A migration that takes 90 milliseconds in staging can hold a lock for nine minutes at production scale.
  2. Test against production-shaped data: a masked snapshot where policy allows it, or generators that reproduce the real distributions where it does not.
  3. Load the endpoints with realistic concurrency, not a single polite request.
  4. Rehearse the rollback once, for real. A rollback plan that has never been executed is a rumor.
  5. Wire the alerts before the traffic arrives, and page on user symptoms rather than server internals.

None of this is glamorous, which is exactly why it is where most software fails. Staging answers one question: did we break the happy path. Production readiness is a different question, and it deserves its own checklist.