apollographql / federation

🌐  Build and scale a single data graph across multiple services with Apollo's federation gateway.
https://apollographql.com/docs/federation/
Other
668 stars 257 forks source link

feat(composition): Improve composition errors / subgraph locations #1016

Open trevor-scheer opened 3 years ago

trevor-scheer commented 3 years ago

Subgraph locations aren't always reported (i.e. in the case of graphql-js errors during composition). This results in a UX where schema authors are given an error without being told where to resolve it.

To reproduce, compose:

type Query @myUndefinedDirective {
  hello: String!
}

Note the resulting composition errors (Unknown directive @myUndefinedDirective) don't contain the subgraph info that would be useful in output.

pcmanus commented 3 years ago

Fwiw, graphql-js errors do have location info in the new federation 2 code. Don't know if we want to go and fix that in the 1.x branch?