Apollo GraphQL schema change rollback safety remains unaddressed after breaking schema updates
0 reputation · 18 Jul 2020, 13:27 UTC
0 reputation · 18 Jul 2020, 13:27 UTC
Apollo GraphQL applies schema validation at request time and rejects queries referencing fields absent from the current schema, yet it does not automatically revert the schema when a breaking change is detected. The schema registry retains prior versions, but no built‑in automatic rollback exists, leaving administrators to manually replace the schema or redeploy services.
Coordinating a rollback across all federated services introduces uncertainty: the gateway must reflect a consistent combined schema, client caches may mask failures, and downtime must be minimized. How can Apollo ensure atomic schema rollback across federated services? What mechanisms exist to automatically revert schema version in the registry when a breaking change is detected? Is there a documented strategy for coordinated rollback without downtime?
35775 reputation · 18 Jul 2020, 22:40 UTC
Apollo GraphQL does not provide built-in automatic schema rollback when a breaking change is detected. The schema registry retains prior composed and subgraph versions, but reverting requires manual action by an administrator. There is no atomic transaction that rolls back all federated subgraphs and the gateway simultaneously.
Apollo Studio schema checks can be configured to BREAK or WARN on breaking changes in CI. They prevent a publish from completing if you gate your pipeline on the check result, but they do not automatically revert a schema that has already been published.
Every published composed schema and subgraph SDL is versioned and retained in the registry. You can inspect history via Apollo Studio or the Rover CLI:
rover graph list my-graph@prod
rover subgraph list my-graph@prodTo roll back, you either:
Since Apollo lacks automatic revert, teams achieve safety through these practices:
Publish the new composed schema to a canary variant first. Route a small percentage of traffic (or internal clients) to it. Monitor error rates and schema validation failures before promoting to prod.
Configure rover graph check as a required status check on your PRs. Set the policy to BREAK for breaking changes. This prevents the breaking publish from reaching the registry in the first place.
Tag subgraph Docker images with the schema version (e.g., subgraph-users:v1.4.2-schema-23). Deploy subgraphs and publish their SDLs atomically in the same pipeline stage. Rollback becomes a single kubectl rollout undo or Helm rollback per service, followed by a Rover republish of the previous composed schema.
Configure the gateway to fetch a specific composed schema variant or use a static supergraph file during rollout. This prevents the gateway from picking up a partially published composition mid-rollout.
Set pollInterval (or fetchInterval in newer gateway versions) to a known value (e.g., 10s). After republishing the prior composed schema, wait at least two intervals before declaring rollback complete.
grep "supergraph" gateway.log | tail -5Are you using managed federation (Apollo Uplink) or self-hosted federation (static supergraph file / Rover composition)? The rollback mechanics differ: managed federation allows composed-schema republish in Studio; self-hosted requires regenerating the supergraph from pinned subgraph SDLs and redeploying the gateway.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.