Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peer dependencies seems to break schema creation. #217

Closed
jcblw opened this issue Oct 4, 2021 · 7 comments
Closed

Peer dependencies seems to break schema creation. #217

jcblw opened this issue Oct 4, 2021 · 7 comments
Labels
bug Something isn't working

Comments

@jcblw
Copy link
Contributor

jcblw commented Oct 4, 2021

I keep getting this issue not sure if its because of the setup in another extension of a issue with the library but it has been persistent and I have not been able to figure out the issue.

Uncaught Error: 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.
    at instanceOf (instanceOf.js:29)
    at isObjectType (definition.js:138)
    at mapArguments (index.mjs:3156)
    at mapDefaultValues (index.mjs:3037)
    at Module.mapSchema (index.mjs:2953)
    at createNewSchemaWithResolvers (index.js:325)
    at addResolversToSchema (index.js:218)
    at addMiddlewareToSchema (middleware.mjs:11)
    at normalisedMiddlewares.reduceRight.schema.schema (middleware.mjs:40)
    at Array.reduceRight (<anonymous>)

I have already added resolutions to the package, and also confirmed that I only have one version of graphql installed.

@jcblw jcblw added the bug Something isn't working label Oct 4, 2021
@jcblw
Copy link
Contributor Author

jcblw commented Oct 5, 2021

Actually ran into another one with the old version of Finch. Think this may be a break from a newer version of graphql or @graphql-tools/schema.

Screen Shot 2021-10-05 at 11 09 54 AM

@jcblw
Copy link
Contributor Author

jcblw commented Oct 5, 2021

This one actually is happening with adding multiple middlewares.

@jcblw
Copy link
Contributor Author

jcblw commented Oct 5, 2021

Ok cleaned up dependencies in this project, and it's working again with the old version of Finch. So def one of the peer dependencies in this instance.

@jcblw
Copy link
Contributor Author

jcblw commented Oct 6, 2021

Thinking this is potentially from a graphql-middleware update. I am seeing it trying to use a new version of the @graphql-tools/schema. Still attempting to verify this is the case.

@jcblw
Copy link
Contributor Author

jcblw commented Oct 6, 2021

Ok seems like I have been able to get this working our solution, which may be too much is

  "resolutions": {
    "graphql": "^15.6.0",
    "@graphql-tools/schema": "7.1.5",
    "graphql-middleware": "6.0.4"
  }

The issue seems to stem from graphql-middleware 6.1.x having version 8 of @graphql-tools/schema. This was causing the issues.

@jcblw
Copy link
Contributor Author

jcblw commented Oct 6, 2021

Thinking we should pin the correct middleware here, make the peers more specific to help others avoid this.

@jcblw jcblw changed the title Unable to use Finch v2 Finch peer dependencies seems to break schema creation. Oct 6, 2021
@jcblw jcblw changed the title Finch peer dependencies seems to break schema creation. Peer dependencies seems to break schema creation. Oct 6, 2021
@jcblw
Copy link
Contributor Author

jcblw commented Dec 5, 2021

This was a misconfiguration, not an issue with this library closing this issue.

@jcblw jcblw closed this as completed Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant