apollographql / apollographql/apollo-client-devtools
IntrospectionQuery fails when dataMasking is enabled
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 172
- Avg merge
- 10m
- Merged PRs (30d)
- 8
Description
**Intended outcome:**
When I open the developer tools in my app and then go to the "explorer" tab, I get an error:
> Schema Introspection Failure
> We couldn't parse your graphql schema, or building your schema failed. The expected format is either IntrospectionQuery or SDL string.
This causes the autocomplete and other nice features of the "explorer" tab not to work properly -- though executing a query works just fine if I manually compose one.
After some debugging, I'm pretty sure that the issue is due to my app's use of fragment / data masking -- I believe masked data is getting sent back to the client, which means that the data that it wants isn't actually there since the `IntrospectionQuery` uses fragments.
Changing my call to `new ApolloClient` in my app from `dataMasking: true` to `dataMasking: false` fixes the issue and allows autocomplete etc to work fine.
**Actual outcome:**
I'd expect the dev tools to work just fine whether or not my app uses data masking.
**How to reproduce the issue:**
Pass `dataMasking: true` as an argument to `new ApolloClient`.
**Desktop (please complete the following information):**
- OS: Windows 10
- Browser: Firefox
- Browser version: 141
- Extension version: 4.18.15
Contributor guide
Research direction
Reproduce the failure in the Explorer tab with an ApolloClient configured with dataMasking: true, then trace the introspection request and schema parsing path in the devtools extension. Done means IntrospectionQuery succeeds and Explorer autocomplete and related schema features work with data masking enabled; use the reported error message to verify the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100