Getting the below error when using executeOperation of v3:
Cannot use GraphQLObjectType "Query" 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.
Overriding the graphql version in overrides section of package.json didn’t work.
npm ls graphql gives the same version in all dependencies & their sub-dependencies.
The dev server is running fine. Issue is happening only during running the jest testcases and the error is thrown from the line where I call executeOperation. Attaching the callstack below:
at instanceOf (node_modules/graphql/jsutils/instanceOf.js:35:13)
at isObjectType (node_modules/graphql/type/definition.js:122:34)
at isCompositeType (node_modules/graphql/type/definition.js:264:10)
at Array.filter (<anonymous>)
at Object.serverWillStart (node_modules/apollo-server-core/src/plugin/cacheControl/index.ts:86:68)
at node_modules/apollo-server-core/src/ApolloServer.ts:444:55
at Array.map (<anonymous>)
at ApolloServer._start (node_modules/apollo-server-core/src/ApolloServer.ts:442:24)
at ApolloServer.executeOperation (node_modules/apollo-server-core/src/ApolloServer.ts:998:7)