Hi,
I try to migrate from graphql-cli get-schema to apollo service:download for getting my graphql schema and from eslint --ext .graphql --config .eslintrc.js to apollo client:check for checking my local graphql files.
$ npm list --depth=0
[email protected] /Users/sebastien/Workspace/ios-app/scripts
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
When I run npx apollo service:download --endpoint=myendpoint/graphql ../schema.json, I have this message in my console
โ ๏ธ It looks like there are 0 files associated with this Apollo Project. This may be because you don't have any files yet, or your includes/excludes fields are configured incorrectly, and Apollo can't find your files. For help configuring Apollo projects, see this guide: https://bit.ly/2ByILPj
โ Loading Apollo Project
โ Saving schema to ../schema.json
โ spurious results.
Error: Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm.
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
https://yarnpkg.com/en/docs/selective-version-resolutions
Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.
at instanceOf (~/Workspace/ios-app/scripts/node_modules/apollo/node_modules/graphql/jsutils/instanceOf.js:37:13)
at isSchema (~/Workspace/ios-app/scripts/node_modules/apollo/node_modules/graphql/type/schema.js:34:34)
at assertSchema (~/Workspace/ios-app/scripts/node_modules/apollo/node_modules/graphql/type/schema.js:38:4)
at validateSchema (~/Workspace/ios-app/scripts/node_modules/apollo/node_modules/graphql/type/validate.js:51:28)
at assertValidSchema (~/Workspace/ios-app/scripts/node_modules/apollo/node_modules/graphql/type/validate.js:75:16)
at assertValidExecutionArguments (~/Workspace/ios-app/scripts/node_modules/apollo/node_modules/graphql/execution/execute.js:146:35)
at executeImpl (~/Workspace/ios-app/scripts/node_modules/apollo/node_modules/graphql/execution/execute.js:67:3)
at execute (~/Workspace/ios-app/scripts/node_modules/apollo/node_modules/graphql/execution/execute.js:62:229)
at Object.introspectionFromSchema (~/Workspace/ios-app/scripts/node_modules/apollo/node_modules/graphql/utilities/introspectionFromSchema.js:38:37)
at Task.task (~/Workspace/ios-app/scripts/node_modules/apollo/lib/commands/service/download.js:16:78)
However, npx apollo client:check --tag=mytag --key=mykey --includes="../**/*.graphql" runs without problem with the same config...
Same problem if I remove [email protected] from my depth=0 dependencies knowing [email protected] has [email protected] as depth=1 dependency (but some transitive dependencies like apollo-codegen-core for [email protected] still require it).
Does anyone be able to enlighten me?
I keep running into this as well. Wish they would add graphql as a peer dependency since apollo tooling has in the past always been behind the rest of the apollo platform with regards to the graphql dependency.
I had the same issue. Upgrading apollo to version 2.8.3 resolved the issue for me.
I had the same issue. Upgrading apollo to version 2.8.3 resolved the issue for me.
Can anyone confirm this fixes the issue or if it's still an issue? If not, I'll close this.
EDIT:
I'm encountering a similar error message but from a different command in version 2.8.3.
When attempting to push local schema to engine schema registry:
npx apollo -v
apollo/2.8.3 darwin-x64 node-v8.6.0
npx apollo service:push --key=KEY
โ Loading Apollo Project
โ Uploading service to Engine
โ spurious results.
Error: Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm.
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
https://yarnpkg.com/en/docs/selective-version-resolutions
Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.
at instanceOf (~/repo/meepshop-api/node_modules/apollo/node_modules/graphql/jsutils/instanceOf.js:37:13)
at isSchema (~/repo/meepshop-api/node_modules/apollo/node_modules/graphql/type/schema.js:34:34)
at assertSchema (~/repo/meepshop-api/node_modules/apollo/node_modules/graphql/type/schema.js:38:4)
at validateSchema (~/repo/meepshop-api/node_modules/apollo/node_modules/graphql/type/validate.js:53:28)
at assertValidSchema (~/repo/meepshop-api/node_modules/apollo/node_modules/graphql/type/validate.js:77:16)
at assertValidExecutionArguments (~/repo/meepshop-api/node_modules/apollo/node_modules/graphql/execution/execute.js:146:35)
at executeImpl (~/repo/meepshop-api/node_modules/apollo/node_modules/graphql/execution/execute.js:67:3)
at execute (~/repo/meepshop-api/node_modules/apollo/node_modules/graphql/execution/execute.js:62:256)
at Object.introspectionFromSchema (~/repo/meepshop-api/node_modules/apollo/node_modules/graphql/utilities/introspectionFromSchema.js:38:37)
at Task.task (~/repo/meepshop-api/node_modules/apollo/lib/commands/service/push.js:23:43)
Hi @JakeDawkins,
$ npm list --depth=0
[email protected] /Users/sebastien/Workspace/ios-app/scripts
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
When I run npx apollo service:download --endpoint=myendpoint/graphql ../schema.json, I still have the same error...
I had the same issue. Upgrading apollo to version
2.8.3resolved the issue for me.
Works for me.