Hi,
What is the behaviour of Apollo Router when a single request fetches response from multiple subgraph and one of subGraph request timeout while other are successful.
- Should the request made to router also timeout? OR
- Request should give partial result for the successful subgraph fields and give proper error for fields where timeout happened.
I tried Apollo Router and It is giving Request Timeout even if one of the subGraph request is successful.
If the behaviour should be case 2. what configuration can I use to achieve this?
Hi,
I dont know if router has a configuration about this, but you can resolve using @defer
This would depend on the query plan and what data is returned from a subgraph error.
If the request that went to a subgraph is a leave node of a query plan or if the data that was expected to be returned is nullable then we can return the errors in the error but any data we got back.
However according to the GraphQL spec, if we are unable to return a non-nullable field back to the clients request we have to fail the response. This is why good schema design and error boundaries are important:
1 Like