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

Support new graphql major (15) #25906

Closed
adrienharnay opened this issue Jul 21, 2020 · 8 comments · Fixed by #29090
Closed

Support new graphql major (15) #25906

adrienharnay opened this issue Jul 21, 2020 · 8 comments · Fixed by #29090
Assignees
Labels
topic: GraphQL Related to Gatsby's GraphQL layer type: bug An issue or pull request relating to a bug in Gatsby

Comments

@adrienharnay
Copy link
Contributor

Description

graphql 15 has been out for a while now (3.5 months), and some libs are starting to upgrade. As a result, today I got this error message:

 Error: Cannot use GraphQLDirective "@cacheControl" 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.

Pinning graphql to 15.3.0 in resolutions makes gatsby crash when running gatsby develop.

Steps to reproduce

Run any gatsby projet with resolutions set to 15.3.0 for graphql.

Expected result

Gatsby should support the latest graphql major.

Actual result

Error on build.

Environment

  System:
    OS: macOS 10.15.5
    CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.4.0 - /var/folders/mt/71kkzssd3fq24s3x3y6wpc4h0000gn/T/yarn--1595324137736-0.6757048113533806/node
    Yarn: 1.22.4 - /var/folders/mt/71kkzssd3fq24s3x3y6wpc4h0000gn/T/yarn--1595324137736-0.6757048113533806/yarn
    npm: 6.14.5 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/local/bin/python
  Browsers:
    Chrome: 84.0.4147.89
    Firefox: 72.0.2
    Safari: 13.1.1

Thanks in advance!

@adrienharnay adrienharnay added the type: bug An issue or pull request relating to a bug in Gatsby label Jul 21, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 21, 2020
@sidharthachatterjee sidharthachatterjee added topic: GraphQL Related to Gatsby's GraphQL layer and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jul 21, 2020
@aaronadamsCA
Copy link
Contributor

graphql-js version 15 has a lot of new features, one of which—interfaces that implement other interfaces—is nice to have when writing Gatsby GraphQL, since it lets you do interface Foo implements Node.

@vladar
Copy link
Contributor

vladar commented Oct 13, 2020

Yup, GraphQL has so many aspects in Gatsby that I think we will bump it with the next Gatsby major.

@vladar vladar assigned vladar and unassigned freiksenet Oct 13, 2020
@usmanbinnaeem
Copy link

@adrienharnay did you get solution

@adrienharnay
Copy link
Contributor Author

@usmanbinnaeem hey, I've kind of stopped using Gatsby altogether so not really, sorry 😕

@usmanbinnaeem
Copy link

@adrienharnay hi, no problem, my error got removed

cometkim added a commit to cometkim/gatsby-plugin-typegen that referenced this issue Jan 4, 2021
Gatsby uses GraphQL 14 and the graphql-tools is compatible with both v14 and v15.

Fixes #120
See also gatsbyjs/gatsby#25906
@openscript
Copy link
Contributor

@adrienharnay hi, no problem, my error got removed

So Gatsby is compatible with GraphQL 15 and greater?

@MMMalik
Copy link

MMMalik commented Feb 8, 2021

@adrienharnay hi, no problem, my error got removed

So Gatsby is compatible with GraphQL 15 and greater?

No, it's not from what I can see.

This is quite problematic for me since I'm working in a monorepo with yarn workspaces and lerna. The problem is that my headless CMS (KeystoneJS) won't accept anything less than graphql@^15.x and gatsby won't accept anything higher than graphql@^14.x. The amount of work I have to put in in order to make multiple instances of graphql error go away is insane... With heavy use of yarn's nohoist feature I am able to bypass that error but it would be much easier if gatsby allowed me to just use yarn resolutions and have a fixed graphql@^15.x. At this moment I'm starting to question my monorepo setup.

From what I can see here even the next major gatsby v3 is still depending on graphql@^14.6.0 👎.

EDIT. When using gatsby@2.32.3 and a fixed version of graphql@15.5.0, I'm getting this error with gatsby:

Missing onError handler for invocation 'building-schema', error was
'TypeError: (0 , _buildASTSchema.getDescription) is not a function'.
Stacktrace was 'TypeError: (0 , _buildASTSchema.getDescription) is not a
function
    at TypeMapper.makeTypeDef (/home/michal/workspace/ilemandatow/packages/
site/node_modules/graphql-compose/lib/TypeMapper.js:884:55)
    at TypeMapper.makeSchemaDef (/home/michal/workspace/ilemandatow/package
s/site/node_modules/graphql-compose/lib/TypeMapper.js:642:21)
    at forEach (/home/michal/workspace/ilemandatow/packages/site/node_modul
es/gatsby/src/schema/schema.js:1210:52)
    at Array.forEach (<anonymous>)
    at parseTypes (/home/michal/workspace/ilemandatow/packages/site/node_mo
dules/gatsby/src/schema/schema.js:1180:19)
    at forEach (/home/michal/workspace/ilemandatow/packages/site/node_modul
es/gatsby/src/schema/schema.js:254:23)
    at Array.forEach (<anonymous>)
    at addTypes (/home/michal/workspace/ilemandatow/packages/site/node_modu
les/gatsby/src/schema/schema.js:246:9)
    at updateSchemaComposer (/home/michal/workspace/ilemandatow/packages/si
te/node_modules/gatsby/src/schema/schema.js:135:9)
    at buildSchema (/home/michal/workspace/ilemandatow/packages/site/node_m
odules/gatsby/src/schema/schema.js:62:9)
    at build (/home/michal/workspace/ilemandatow/packages/site/node_modules
/gatsby/src/schema/index.js:105:24)
    at buildSchema (/home/michal/workspace/ilemandatow/packages/site/node_m
odules/gatsby/src/services/build-schema.ts:19:3)'

@vladar
Copy link
Contributor

vladar commented Feb 8, 2021

GraphQL bump is ready to get merged via #29090 . It will be released as a part of Gatsby v3.

cometkim added a commit to cometkim/gatsby-plugin-typegen that referenced this issue May 10, 2021
Gatsby uses GraphQL 14 and the graphql-tools is compatible with both v14 and v15.

Fixes #120
See also gatsbyjs/gatsby#25906
cometkim added a commit to cometkim/gatsby-plugin-typegen that referenced this issue May 11, 2021
Gatsby uses GraphQL 14 and the graphql-tools is compatible with both v14 and v15.

Fixes #120
See also gatsbyjs/gatsby#25906
cometkim added a commit to cometkim/gatsby-plugin-typegen that referenced this issue Mar 23, 2022
Gatsby uses GraphQL 14 and the graphql-tools is compatible with both v14 and v15.

Fixes #120
See also gatsbyjs/gatsby#25906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: GraphQL Related to Gatsby's GraphQL layer type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants