Story #33 API Gateway Conformance · Environment Parity

The Same API Behaved Differently Behind Different Gateways

"Development said it worked. Staging failed. Production had a third behavior"

Redwood Commerce's API gateway had different configurations across environments—different timeout values, authentication modes, and request transformation rules. Bugs that couldn't be reproduced in development were invisible until they reached production.

What happened

Redwood Commerce deployed its order APIs through an API gateway that handled routing, authentication, request transformations, rate limits, and timeouts before forwarding to backend services.

Three separate gateway configurations existed: development, staging, and production. They had been created at different times by different teams. Over months, they diverged. Development had longer timeouts than production. Staging used a different authentication plugin version. Production had a request transformation rule that neither development nor staging had, introduced to work around a backend bug that had since been fixed.

Developers tested against development. QA ran against staging. Production was different from both.

A new feature worked correctly in development. It failed in staging due to a header transformation applied by staging’s authentication plugin. The team fixed the header handling and deployed to staging. It passed. It failed in production due to the lingering transformation rule that reordered certain request fields.

The team spent three days debugging a production issue that couldn’t be reproduced in any lower environment.

Root cause

Gateway configurations were treated as infrastructure, not as part of the API contract. No conformance tests verified that gateway behavior was consistent across environments. No diff tooling tracked configuration divergence between environments.

The fix

Gateway configurations were migrated to a shared infrastructure-as-code repository with environment-specific overrides limited to values like endpoint URLs and credential references. Conformance tests that sent requests through the gateway—not directly to backend services—were added for all environments. Configuration drift was automatically detected and alerted.

Lesson learned

The API contract includes every layer between the client and the backend. Gateway timeout, authentication, transformation, and routing behavior are all part of the contract—and must be tested through the actual gateway in every environment where behavior can differ.

The Same API Behaved Differently Behind Different Gateways