gatsby: RootQueryType.allSitePage field type must be Output Type but got: SitePageConnection.
Got the following error when trying to build my project on Netlify (haven’t been able to replicate locally):
Error: RootQueryType.allSitePage field type must be Output Type but got: SitePageConnection.
- Array.forEach
- Array.reduce
- index.js:54 _callee$
[repo]/[gatsby]/dist/schema/index.js:54:20
Just updated my gatsby version (didn’t work with 1.6.X either), so these are my current gatsby dependencies:
"gatsby": "^1.9.21",
"gatsby-link": "^1.6.16",
"gatsby-plugin-react-helmet": "^1.0.6",
"gatsby-plugin-sass": "^1.0.10",
"gatsby-plugin-sitemap": "^1.2.5",
"gatsby-plugin-styled-components": "^1.0.5",
"gatsby-source-contentful": "^1.3.7",
"gatsby-source-filesystem": "^1.4.11",
"gatsby-transformer-toml": "^1.1.4",
Any idea as to what can cause this on Netlify but not locally? And optimally a hint on how to fix it 🗡
UPDATE:
I found a way to replicate this locally. If I update the graphql version to the latest one it happens. And the problem externally seemed to be my node version. It failed when running Node 6.X, but works with Node 8.X
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 32 (14 by maintainers)
I came across this issue when erroneously thinking I may have to additionally install graphql. Silly of me, but it would still be nice if running an innocent “npm install graphql” in a gatsby project wouldn’t kill it the way it did.
Working on a gatsby-example-site starter.
What solved it for me: npm remove graphql npm install gatsby
I found a
working solutionworkaround for my projects.I added
graphql
as peerDependency in my plugin package.json, and after a fresh packages installation and regeneration of the package-lock.json file, build work perfectly.No more errors.
In my node_modules folder I have only one graphql folder.
Maybe is not the best solution, but it suit for my needs 😸
Just want to add my own experience about this issue as I am now writing a plugin (transformer). @G100g 's solution/workaround worked for me, in production. i.e. I added
graphql
as peer dependency, publish my package to npm, install it on my site, it worked. But it doesn’t work when I try to develop the plugin. My setup is: in my site folder I haveMySite/plugins/my-plugin
, which is a symbol link to my local development repo ofmy-plugin
. In order for it to work, like @G100g said, I have to symbol linkgraphql
from my site’snode_modules
folder to mymy-plugin
one, it’s very fiddly, for plugin developers, and intimidating for first time plugin developers.UPDATE: In case anyone is interested in the detailed setup, here is my plugin. It’s a org-mode transformer, which is totally based on the Remark one.
I have a same problem with gatsby@1.9.74. I found just 1 more graphql module in node_modules folder which is dependent by
graphql-skip-limit
(depedency of gatsby). And I removed that.then bootstrapping worked well. Now I installed latest version of gatsby@1.9.155, there is no more problem. Of course there is no additional graphql folder in node_modules.
There was a difference in package-lock.json(I use npm rather than yarn)
I think this issue might be a problem with some other dependency module which uses graphql.
@KyleAMathews yeah I think it is: https://code.facebook.com/posts/274518539716230/announcing-yarn-1-0/
Regarding the Yarn issue, I’m not getting it with a gatsby starter project. But I am getting it with my typescript gatsby project.
Really looking forward to the graphql-js fix. Because I’m with @mboudreau on this on. Being blocked by “hard to debug” magic is frustrating.
This shouldn’t be seen as a rant though. I really appreciate all the hard work you and the contributors have put into this project. I realize projects like these are only as good as the contributions made by it’s users. And you spun out an incredible set of features for the 1.0 release.
So it is only what could be expected. And as soon as I have a few extra hours again, I’ll do what I can to give back to the project!
This is usually (always) due to having more than one copy of graphql installed in your dependency tree, which it really hates. We should have a page about fixing it tho