graphql-tools: Receive 'Cannot use GraphQLSchema' error when using makeExecutableSchema in junction with SchemaLink
Hi, everyone!
When trying to run GraphQL w/o a server, providing SchemaLink
created using makeExecutableSchema
, I receive an error when running a query:
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 new ApolloError (https://t0i3t.csb.app/node_modules/@apollo/client/errors/ApolloError.js:42:24)
at ObservableQuery.getCurrentResult (https://t0i3t.csb.app/node_modules/@apollo/client/core/ObservableQuery.js:123:18)
at QueryData._this.getQueryResult (https://t0i3t.csb.app/node_modules/@apollo/client/react/data/QueryData.js:42:53)
at QueryData.getExecuteResult (https://t0i3t.csb.app/node_modules/@apollo/client/react/data/QueryData.js:160:23)
at QueryData.execute (https://t0i3t.csb.app/node_modules/@apollo/client/react/data/QueryData.js:113:47)
at eval (https://t0i3t.csb.app/node_modules/@apollo/client/react/hooks/utils/useBaseQuery.js:56:55)
at useDeepMemo (https://t0i3t.csb.app/node_modules/@apollo/client/react/hooks/utils/useDeepMemo.js:19:14)
at useBaseQuery (https://t0i3t.csb.app/node_modules/@apollo/client/react/hooks/utils/useBaseQuery.js:55:50)
at useQuery (https://t0i3t.csb.app/node_modules/@apollo/client/react/hooks/useQuery.js:14:46)
at Message (https://t0i3t.csb.app/src/App.js:59:40)
at renderWithHooks (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:16260:18)
at updateFunctionComponent (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:18347:20)
at beginWork$1 (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:20176:16)
at beginWork$$1 (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:25756:14)
at performUnitOfWork (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:24695:12)
at workLoopSync (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:24671:22)
at performSyncWorkOnRoot (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:24270:11)
at eval (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:12199:24)
at unstable_runWithPriority (https://t0i3t.csb.app/node_modules/scheduler/cjs/scheduler.development.js:697:12)
at runWithPriority$2 (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:12149:10)
at flushSyncCallbackQueueImpl (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:12194:7)
at flushSyncCallbackQueue (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:12182:3)
at scheduleUpdateOnFiber (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:23709:9)
at dispatchAction (https://t0i3t.csb.app/node_modules/react-dom/cjs/react-dom.development.js:17076:5)"
My dependencies are:
"@apollo/client": "3.0.1",
"@graphql-tools/schema": "6.0.13",
"graphql": "15.3.0",
"react": "16.12.0",
"react-dom": "16.12.0",
From what I can gather, I have only one graphql
available so I’m not even sure that the message hits in the right direction.
The demo is available here
I don’t have a GraphQL server available at my disposal. After considering the @rest
directive I’ve come to the conclusion that having full-bodied resolvers would be cleaner and would easily integrate into the existing codebase.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (4 by maintainers)
Hi, @danielrearden! Thanks for your quick reply! I’m seeing the same error on my local environment. The code on sandbox is a boiled-down version to trace down the issue.