Schema download failing again with graphql 14.4.2 ("Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm")
See original GitHub issueIntended outcome:
Schema download succeeds.
Actual outcome:
Schema download fails:
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 (/opt/app/node_modules/apollo/node_modules/graphql/jsutils/instanceOf.js:28:13)
at isSchema (/opt/app/node_modules/apollo/node_modules/graphql/type/schema.js:34:34)
at assertSchema (/opt/app/node_modules/apollo/node_modules/graphql/type/schema.js:38:4)
at validateSchema (/opt/app/node_modules/apollo/node_modules/graphql/type/validate.js:44:28)
at assertValidSchema (/opt/app/node_modules/apollo/node_modules/graphql/type/validate.js:68:16)
at assertValidExecutionArguments (/opt/app/node_modules/apollo/node_modules/graphql/execution/execute.js:163:35)
at executeImpl (/opt/app/node_modules/apollo/node_modules/graphql/execution/execute.js:84:3)
at execute (/opt/app/node_modules/apollo/node_modules/graphql/execution/execute.js:62:63)
at Object.introspectionFromSchema (/opt/app/node_modules/apollo/node_modules/graphql/utilities/introspectionFromSchema.js:31:37)
at Task.task (/opt/app/node_modules/apollo/lib/commands/service/download.js:21:82)
How to reproduce the issue:
Run yarn apollo service:download schema.json --endpoint {endpoint_url}
.
Versions
I’m on apollo 2.15.0. I got the same error on 2.12.3, as described here, but this PR temporarily fixed it. But now after upgrading from graphql 14.4.0 to 14.4.2, I’m getting the error again.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Error: Cannot use GraphQLSchema "[object ... - Stack Overflow
I get this error: Error: Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm. Ensure that there is only one instance ...
Read more >How to fix the error: “Cannot use GraphQLSchema “[object ...
Failure: Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm. Ensure that there is only one instance of "graphql" ...
Read more >GraphQL Content API - Contentful
Schema generation fails when: Two or more content type IDs would be transformed to the same type name. Two or more field IDs...
Read more >Get started with Apollo Server - Apollo GraphQL Docs
Define a GraphQL schema that represents the structure of your data set; Run an instance of Apollo Server that lets you execute queries...
Read more >Ben Awad on Twitter: "Love seeing "Cannot use ...
Love seeing "Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm." every time I upgrade the graphql package. ... as peerDependency. We ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@JakeDawkins (how’s it going?) I am now seeing this error pretty much no matter what. I tried a fresh install, tried hardcoding apollo
2.18
and graphql14.4.2
. Nothing seems to be working. Is it possible some dependency got messed up in an associated repo? Are you seeing this on a fresh install?Repro for me:
npx apollo service:download --endpoint=http://localhost:4000
I tried yarn and npm. I can confirm with package-lock.json and yarn lock that the same version of graphql is being used everywhere. Tried resolutions in the package.json.
Any ideas?
Was dealing this issues. My fix was to add the resolution and yarn upgrade. Versioning thing