parse-community / parse-server

Parse Server for Node.js / Express
https://parseplatform.org
Apache License 2.0
20.95k stars 4.78k forks source link

GraphQL Error #7818

Open behnik opened 2 years ago

behnik commented 2 years ago

Error: Cannot use GraphQLObjectType "RoleConnection" 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 (/app/node_modules/parse-server/node_modules/graphql/jsutils/instanceOf.js:35:13) at isObjectType (/app/node_modules/parse-server/node_modules/graphql/type/definition.js:122:34) at isType (/app/node_modules/parse-server/node_modules/graphql/type/definition.js:92:32) at isNullableType (/app/node_modules/parse-server/node_modules/graphql/type/definition.js:422:10) at assertNullableType (/app/node_modules/parse-server/node_modules/graphql/type/definition.js:426:8) at new GraphQLNonNull (/app/node_modules/parse-server/node_modules/graphql/type/definition.js:379:19) at Object.load (/app/node_modules/parse-server/lib/GraphQL/loaders/parseClassQueries.js:109:13) at /app/node_modules/parse-server/lib/GraphQL/ParseGraphQLSchema.js:109:25 at Array.forEach () at ParseGraphQLSchema.load (/app/node_modules/parse-server/lib/GraphQL/ParseGraphQLSchema.js:107:71)

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this issue!

mtrezza commented 2 years ago

Can you please edit your post and use the issue template provided. We need the info from the template fields to investigate this.

Moumouls commented 2 years ago

@behnik it seems that you have 2 graphql versions into your project. If you do not have installed graphql, you can use Yarn resolutions to force all your packages to use the same graphql version: https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/

dbruvers commented 2 years ago

I experienced the same error after upgrading Parse Server and Parse Dashboard to the latest version. It seems that each required their own GraphQL version.

I had no specific version constraints so I removed the package lock file, removed the dependencies from package.json and then added them back one by one. First I installed Parse Server and Parse Dashboard afterwards. This worked for parse-server v. 5.2.0 and parse-dashboard v. 4.1.0.

Moumouls commented 1 month ago

@mtrezza we should sync now last graphql version on parse-dashboard to resolve this issue

mtrezza commented 1 month ago

Duplicate "graphql" modules cannot be used at the same time since different versions may have different capabilities and behavior.

What are the compatibility requirements? Down to the exact same version? That sounds difficult to maintain. What's the solution here? Do we need to add a compatibility section for GraphQL to the README of both parse-server and parse-dashboard like we have for example for Node.js?