question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keystone 16.0.0 Error: Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm

See original GitHub issue

Bug report

Describe the bug

I get the following error after bumping @keystonejs/keystone to ^16.0.0:

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 (/home/toye/Dev/js/vue/musicx/node_modules/@keystonejs/keystone/node_modules/graphql/jsutils/instanceOf.js:29:13)
    at Object.isSchema (/home/toye/Dev/js/vue/musicx/node_modules/@keystonejs/keystone/node_modules/graphql/type/schema.js:42:34)
    at new ApolloServerBase (/home/toye/Dev/js/vue/musicx/node_modules/@keystonejs/keystone/node_modules/apollo-server-core/dist/ApolloServer.js:160:23)
    at new ApolloServer (/home/toye/Dev/js/vue/musicx/node_modules/@keystonejs/keystone/node_modules/apollo-server-express/dist/ApolloServer.js:60:9)
    at Keystone.createApolloServer (/home/toye/Dev/js/vue/musicx/node_modules/@keystonejs/keystone/lib/Keystone/index.js:453:20)
    at Keystone.prepare (/home/toye/Dev/js/vue/musicx/node_modules/@keystonejs/keystone/lib/Keystone/index.js:615:10)
    at executeDefaultServer (/home/toye/Dev/js/vue/musicx/node_modules/@keystonejs/keystone/bin/utils.js:149:42)

my dependencies:

"dependencies": {
    "@keystonejs/adapter-mongoose": "^9.0.7",
    "@keystonejs/app-admin-ui": "^7.3.6",
    "@keystonejs/app-graphql": "^6.1.2",
    "@keystonejs/app-nuxt": "^5.1.6",
    "@keystonejs/auth-password": "^5.1.14",
    "@keystonejs/fields": "^17.1.3",
    "@keystonejs/fields-cloudinary-image": "^1.0.6",
    "@keystonejs/fields-markdown": "^5.2.9",
    "@keystonejs/fields-wysiwyg-tinymce": "^5.3.10",
    "@keystonejs/file-adapters": "^7.0.7",
    "@keystonejs/keystone": "^16.0.0",
    "@keystonejs/list-plugins": "^7.1.1",
    "@nuxtjs/apollo": "^4.0.1-rc.3",
    "cross-env": "^7.0.2",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
  },

Deleting ./node_modules/@keystonejs/keystone/node_modules/graphql allows the app to build and start 🤷‍♂️

System information

  • OS: Windows / WSL2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
bookyocommented, Sep 26, 2020

in package.json

"resolutions": {
    "graphql": "15.3.0"
  }

can fix this issue.

1reaction
TkinterinShanghaicommented, Sep 11, 2022

This issue is still relevant. I just started using keystone for the first time and immediately ran into this error

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keystone 16.0.0 Error: Cannot use GraphQLSchema "[object ...
Error: Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm. Ensure that there is only one instance of "graphql" ...
Read more >
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 ...
Error: Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm. Ensure that there is only one instance of "graphql" ...
Read more >
Hírek, események - RisingStack Engineering
The second turned out to be the missing keystone of the organizational shift. ... Object.hasOwn is a static alias for Object.prototype.hasOwnProperty.call :
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found