parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

GraphQL Error

Open behnik opened this issue 3 years ago • 6 comments

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)

behnik avatar Feb 20 '22 07:02 behnik

Thanks for opening this issue!

  • ❌ Please edit your post and use the provided template when creating a new issue. This helps everyone to understand your post better and asks for essential information to quicker review the issue.

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

mtrezza avatar Mar 03 '22 16:03 mtrezza

@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/

Moumouls avatar Mar 10 '22 08:03 Moumouls

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.

dbruvers avatar Apr 15 '22 08:04 dbruvers

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

Moumouls avatar Oct 24 '24 06:10 Moumouls

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?

mtrezza avatar Oct 24 '24 20:10 mtrezza