API / Apollo Gateway Interview questions
What happens when a subgraph is unavailable at runtime?
If a query needs data from a subgraph that's down or unreachable, the gateway doesn't necessarily fail the whole request. It still resolves whatever it can from the healthy subgraphs, and returns a GraphQL error — scoped to the affected field's path — for the parts that depended on the unreachable service.
Whether the client still gets a usable partial response depends on GraphQL's null-propagation rules: if the affected field is nullable, it's simply set to null and the rest of the response is intact. If it's non-nullable, that null bubbles up to the nearest nullable ancestor, which can null out a larger chunk of the response — or even the whole thing if the failure happens near the root.
Both Gateway and Router also apply a per-subgraph fetch timeout, so one hung service can't stall the entire request indefinitely; a timeout is treated the same way as any other subgraph failure.
More Related questions...