Closed stevebreault closed 4 years ago
This sounds like a dependency issue. Please run npm ls graphql
(in the project root) and post the output here. Also, have you tried removing node_modules
and re-installing dependencies?
Here's the output of npm ls graphql
:
├─┬ @aws-amplify/api@2.2.0
│ └── graphql@14.0.0
└─┬ gatsby@2.20.8
└── graphql@14.6.0
It fails trying to build from source on CI/CD deployment where no node_modules
folder yet exists since it's pulling directly from the git repo.
I tried to rebuild from an empty hello-world
starter and hit the same issue.
The problem is that @aws-amplify/api
uses a specific version of graphql
package (14.0.0
). So it is incompatible with any package that requires another version of graphql. Gatsby requires graphql@^14.6.0
.
Ideally @aws-amplify/api
should upgrade dependencies. Until then you will probably have to use resolutions feature of yarn to workaround this problem.
Version ^14.6.0
should be directly compatible with 14.0.0
.
I previously tried the resolutions route as well. Unfortunately, it doesn't fully address the problem as it causes downstream errors that still prevent the build from working.
Can you elaborate a bit? What kind of errors? Because the proper fix is to have a single copy of graphql for the whole project and that's exactly what resolutions are supposed to do.
Technically this error is emitted by graphql
itself here, not Gatsby. So we can't do much about it in Gatsby.
The errors I get afterwards are AWS Amplify specific schema errors. And since, as you mention, the error is really GraphQL-centric and the fact that there's not much that can be done in Gatsby, I have to pick between either Gatsby working or the Amplify API. I'm pretty much resigned to having Gatsby work as designed and changing how I connect to my AWS GraphQL endpoints.
I get the same error whith the following npm ls graphql
├─┬ gatsby@2.20.36
│ ├─┬ gatsby-cli@2.11.22
│ │ └─┬ gatsby-recipes@0.0.19
│ │ └── graphql@14.6.0 deduped
│ └── graphql@14.6.0
└─┬ gatsby-source-prismic-graphql@3.5.0
├─┬ gatsby-source-graphql@2.4.3
│ └── graphql@14.6.0 deduped
└─┬ gatsby-source-graphql-universal@3.1.11
└─┬ @types/graphql@14.5.0
└── graphql@15.0.
resolved it with https://github.com/birkir/gatsby-source-graphql-universal/issues/14
Thanks for opening this issue! As stated, this is slightly tangential to Gatsby, and it seems like we’ve provided enough information to make an informed decision.
If this is not the case, or if we can help further — please don’t hesitate to reach out or comment on this issue, and we’d love to take another look.
Thanks for using Gatsby :muscle:
I solved this issue by adding
"resolutions": {
"graphql": "14.6.0"
}
to my package.json
If you're using npm
8.3.x
or higher, you can now use:
"overrides": {
"graphql": "14.6.0"
}
...since npm doesn't support resolutions
Description
While deploying a new site version where CI runs its own build for deployment, I am now running into a new error. When running
gatsby develop
, as it runs though plugin initialization, I am now getting the following error:Which is followed by the following warning:
Previous to this, the project was running gatsby-source-graphql@2.1.33. Downgrade is however not fixing the issue.
Steps to reproduce
List of installed dependencies, updated from hello-world starter:
Configuration of plugin in
gatsy-config.js
:Expected result
Previously, the plugin would run without issue and create the source nodes successfully
Actual result
When the plugin is initialized, it throws the error above.
Environment