running into ``` Error: Cannot use GraphQLSchema ...
# prisma-whats-new
p
running into
Copy code
Error: Cannot use GraphQLSchema "[object Object]" 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 (/Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/graphql/jsutils/instanceOf.js:17:13)
    at isSchema (/Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/graphql/type/schema.js:48:35)
    at validateSchema (/Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/graphql/type/validate.js:51:25)
    at assertValidSchema (/Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/graphql/type/validate.js:76:16)
    at Object.validate (/Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/graphql/validation/validate.js:61:35)
    at doRunQuery (/Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/apollo-server-core/src/runQuery.ts:143:30)
    at /Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/apollo-server-core/src/runQuery.ts:69:39
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
any ideas what is going on here?
a
I fixed this by adding
Copy code
"resolutions": {
"graphql": "^0.13.0"
}
to my package.json.
p
thanks for that suggestion, I will try it but I want to understand if this is an issue with
graphql
package or something else
n
This is an issue with your dependency tree. it contains at least two different versions of
graphql
. I don't know exactly why, but
graphql
doesn't like that at all 😛
that is the npm package
graphql
, not the
graphql-cli
a
The solution I mentioned is yarn’s recommended solution for this problem, until the libraries are using compatible versions.
👍 1
p
weird…because this first occurred today when starting a fresh
typescript-advanced
project
so the
resolutions
key is added to the
package.json
of the prisma service is assume?
a
Yes
p
thank you, confirming this suggestion worked!
a
No problem.
n
@peter, could you raise an issue about this here: https://github.com/graphql-boilerplates/typescript-graphql-server?
👍 1
m
This workaround does not appear to work when deploying to now.