API / Apollo Gateway Interview questions
How do you troubleshoot composition errors when publishing a new subgraph schema?
Composition errors are usually specific and actionable if you read them closely rather than guessing.
- Read the exact error message — Rover/GraphOS typically names the specific field or type and the reason, such as a field having a mismatched type across two subgraphs.
- If the conflict is a field intentionally defined in more than one subgraph, check whether it needs to be marked
@shareable. - Check
@keyconsistency — the key fields for a given entity need to be spelled and typed identically everywhere that entity is extended. - Verify that any
@requiresor@providesfield selections actually exist, spelled correctly, in the subgraph they reference. - Reproduce locally with
rover supergraph composeagainst a static supergraph config file before pushing again. - Run
rover subgraph checkto preview the composition impact against the currently published supergraph before publishing for real.
Most composition errors trace back to one of two root causes: an unmarked duplicate field definition, or inconsistent @key fields between subgraphs contributing to the same entity.
More Related questions...