Apollo Federation composition error "INVALID_GRAPHQL" in CI
Federation composition merges subgraph schemas into one supergraph. When a subgraph defines something invalid or two subgraphs disagree, rover supergraph compose reports composition errors with codes like INVALID_GRAPHQL and exits non-zero.
What this error means
A rover supergraph compose step fails with "Encountered X build errors while trying to build a supergraph." and lines tagged [INVALID_GRAPHQL] naming the offending subgraph and type.
Error: Encountered 1 build error while trying to build a supergraph.
Caused by:
[INVALID_GRAPHQL] On subgraph "products": Unknown type "Money".Common causes
A subgraph references an undefined type
A field uses a type the subgraph never defines or imports, so that subgraph schema is invalid and composition aborts.
Subgraphs disagree on a shared type or directive
Two subgraphs define the same type with incompatible shapes, or misuse a federation directive (@key, @external), producing a composition error.
How to fix it
Read the build error and fix the named subgraph
- Find the
[INVALID_GRAPHQL]line and the subgraph it names. - Define or import the missing type, or correct the federation directive.
- Re-run compose until it produces a supergraph cleanly.
rover supergraph compose --config supergraph.yamlValidate each subgraph before composing
Check subgraphs individually so an invalid one is caught before the compose step.
rover subgraph check my-graph@current \
--schema ./products.graphql --name productsHow to prevent it
- Compose the supergraph in CI on every subgraph change.
- Keep shared types and federation directives consistent across subgraphs.
- Validate each subgraph schema before composition.