-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
When issuing a query such as query { noSuchField }, and passing hideSchemaDetailsFromClientErrors: true to the ApolloServer constructor, the Apollo strips "did you mean" suggestions from the error response as expected.
However, when the error arises from a query variable coercion error, the "did you mean" suggestion is not stripped from the error message.
This can be worked around using a suitable error formatter, but the docs should at least highlight that the hideSchemaDetailsFromClientErrors setting does not apply to this case.
Example Scenario
- Create an ApolloServer with the
hideSchemaDetailsFromClientErrorssetting set totrue - Invoke a query e.g.
query GetUser($filter: UserFilter!) { users(filter: $filter) { id } } - Pass in variables
{ "filter": { "nam": "Bob" } }where the filter fieldnamis a mispelling of the true fieldUseFilter.name
The returned error message will be of the form
"$filter" got invalid value { nam: "Bob" }; Field "nam" is not defined by type "UserFilter". Did you mean "name"?
which contains the Did you mean schema hint; this is likely because the error is trapped during value coercion, and as a result:
- Apollo’s
validationDidStart()hook doesn’t get called with these errors - The internal
ApolloServerPluginDisableSuggestionsplugin never sees the error - The error passes through unmodified to the client
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels