Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spurious error: The field __schema does not exist on Query #889

Closed
mrflip opened this issue Jul 3, 2020 · 1 comment · Fixed by #893
Closed

Spurious error: The field __schema does not exist on Query #889

mrflip opened this issue Jul 3, 2020 · 1 comment · Fixed by #893
Labels
bug 🐛 Oh no! A bug or unintented behaviour.

Comments

@mrflip
Copy link
Contributor

mrflip commented Jul 3, 2020

I am getting a warning The field__schemadoes not exist onQuery, but the GraphQL document expects it to exist.. @JoviDeCroock on Spectrum advised that likely this is a spurious console warning that should be suppressed. This error happens only when I load the devtools, but I've been advised that I should file the bug here (which I noticed after filing it there as urql-graphql/urql-devtools#269 -- have closed that issue)

urql version & exchanges: "urql": "^1.9.8"; "urql-persisted-queries": "^0.1.0"; "@urql/exchange-graphcache": "^3.0.1", "@urql/exchange-populate": "^0.1.8", "@urql/exchange-retry": "^0.1.8"

Steps to reproduce

This sandbox reproduces the error: https://codesandbox.io/s/urql-devtools-no-like-schema-rawr-163fs

I prepared the schema to feed to the cacheExchange using the script given in the docs, taking it from most recent stable release of apollo-server. Queries work and tools like insomnia happily gather the schema, so I think introspection is working correctly on the server side. The first part of my schema.json file is

{"__schema":{"queryType":{"name":"Query"},"mutationType":{"name":"Mutation"},"subscriptionType":null,"types":[{"kind":"INTERFACE","name":"Node","fields":[{"name":"id","args":[],"type":{"kind":"NON_NULL","name":null,"ofType":{"kind":"SCALAR","name":"ID","ofType":null}},"isDeprecated":false,"deprecationReason":null}],"inputFields":null,"interfaces":[],"enumValues":null,"possibleTypes":[{"kind":"OBJECT","name":"DeleteAdjustment","ofType":null},...

Expected behavior

No warnings from console.

Actual behavior

Here is the snipped error callstack from the console:

muteWarnings.fx.ts:22 Invalid field: The field `__schema` does not exist on `Query`, but the GraphQL document expects it to exist.
Traversal will continue, however this may lead to undefined behavior!
(Caused At: "IntrospectionQuery" query)
https://bit.ly/2XbVrpR#4
warn @ muteWarnings.fx.ts:22
z @ urql-exchange-graphcache.mjs:58
E @ urql-exchange-graphcache.mjs:111
Z @ urql-exchange-graphcache.mjs:694
$a @ urql-exchange-graphcache.mjs:646
ab @ urql-exchange-graphcache.mjs:636
d @ urql-exchange-graphcache.mjs:830
(anonymous) @ wonka.mjs:678
(anonymous) @ wonka.mjs:468
(anonymous) @ wonka.mjs:812
b @ wonka.mjs:811
...

I'm using Chrome browser with most recent devtools plugin (Version 2.1.0, installed July 1). Package file:

  "dependencies": {
    "@expo/samples": "~36.0.0",
    "@expo/vector-icons": "^10.0.0",
    "@react-native-community/async-storage": "~1.11.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "5.9.2",
    "@react-native-firebase/app": "^7.3.0",
    "@react-navigation/core": "^5.11.1",
    "@react-navigation/material-bottom-tabs": "^5.2.12",
    "@react-navigation/native": "^5.6.1",
    "@react-navigation/stack": "^5.6.2",
    "@react-navigation/web": "~1.0.0-alpha.9",
    "@urql/exchange-graphcache": "^3.0.1",
    "@urql/exchange-populate": "^0.1.8",
    "@urql/exchange-retry": "^0.1.8",
    "aws-amplify": "^3.0.18",
    "babel-plugin-transform-object-from-entries": "^1.0.0",
    "expo": "^38.0.0",
    "expo-asset": "~8.1.7",
    "expo-constants": "~9.1.1",
    "expo-device": "~2.2.1",
    "expo-firebase-analytics": "~2.4.1",
    "expo-firebase-core": "~1.1.1",
    "expo-font": "~8.2.1",
    "expo-linking": "^1.0.3",
    "expo-secure-store": "~9.0.1",
    "expo-splash-screen": "~0.3.1",
    "expo-updates": "~0.2.8",
    "expo-web-browser": "~8.3.1",
    "firebase": "7.9.0",
    "formik": "^2.1.4",
    "graphql": "^15.2.0",
    "graphql-tag": "^2.10.3",
    "lodash": "^4.17.15",
    "moment": "^2.27.0",
    "react": "16.11.0",
    "react-dom": "16.11.0",
    "react-hook-form": "^5.7.2",
    "react-native": "https://github.com/expo/react-native/archive/sdk-38.0.0.tar.gz",
    "react-native-elements": "^2.0.2",
    "react-native-formik": "^1.7.8",
    "react-native-gesture-handler": "~1.6.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-numeric-input": "https://github.com/himelbrand/react-native-numeric-input.git",
    "react-native-paper": "^3.8.0",
    "react-native-paper-form-builder": "^1.0.6",
    "react-native-reanimated": "~1.9.0",
    "react-native-safe-area-context": "3.0.2",
    "react-native-screens": "~2.9.0",
    "react-native-vector-icons": "^6.6.0",
    "react-native-web": "~0.11.7",
    "sprintf-js": "^1.1.2",
    "urql": "^1.9.8",
    "urql-persisted-queries": "^0.1.0",
    "yup": "^0.29.1"
  },
  "devDependencies": {
    "@babel/cli": "^7.10.3",
    "@babel/core": "^7.10.3",
    "@babel/plugin-transform-modules-commonjs": "^7.10.1",
    "@babel/preset-flow": "^7.10.1",
    "@babel/runtime": "^7.10.3",
    "babel-eslint": "^10.1.0",
    "babel-plugin-import-graphql": "^2.7.0",
    "babel-preset-expo": "^8.2.3",
    "eslint": "^7.3.1",
    "eslint-config-airbnb": "^18.2.0",
    "eslint-plugin-import": "^2.21.1",
    "eslint-plugin-jsx-a11y": "^6.3.1",
    "eslint-plugin-react": "^7.20.0",
    "eslint-plugin-react-hooks": "^4.0.4",
    "eslint-plugin-react-native": "^3.8.1",
    "jest-expo": "^38.0.0",
    "standard-version": "^8.0.0",
    "standard-version-expo": "^1.0.3"
    "@urql/devtools": "^2.0.2",
  },

I'm hoping this is straigtforward to reproduce, but happy to gather more data as needed..

@mrflip mrflip added the bug 🐛 Oh no! A bug or unintented behaviour. label Jul 3, 2020
@mrflip
Copy link
Contributor Author

mrflip commented Jul 3, 2020

BTW @JoviDeCroock's analysis was "You can safely ignore this, this seems to be due to the devtools fetching your introspected schema through an urql-client. Graphcache doesn't recognise these fields and makes you aware of it. We'll look into this"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Oh no! A bug or unintented behaviour.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant