birkir / gatsby-source-graphql-universal Goto Github PK
View Code? Open in Web Editor NEWPlugin for connecting arbitrary GraphQL APIs to Gatsby GraphQL with client side execution
Plugin for connecting arbitrary GraphQL APIs to Gatsby GraphQL with client side execution
Since you're redirecting from https://github.com/birkir/gatsby-plugin-prismic-preview to here, do you happen to have an example of how to setup gatsby-source-graphql-universal to work with Prismic previews?
I was trying to verify this plugin works with latest version of gatsby-source-graphql that uses graphql-tools-fork instead of graphql-tools.
I couldn't get the example working, however, looks like passing along query hash instead of query.
Any guidance?
I'm not sure how this came up, I started getting the error below on my projects that depend on gatsby-source-prismic-graphql.
ERROR #11321 PLUGIN
"gatsby-source-prismic-graphql" threw an error while running the sourceNodes lifecycle:
Cannot use GraphQLDirective "@include" 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.
78 | if (!sdl) {
79 | introspectionSchema = yield introspectSchema(link);
> 80 | sdl = printSchema(introspectionSchema);
| ^
81 | } else {
82 | introspectionSchema = buildSchema(sdl);
83 | }
File: ..\..\node_modules\gatsby-source-graphql-universal\gatsby-node.js:80:15
This indicates multiple versions of graphql which is obviously not allowed.
A couple of other issues posted in the last few days:
birkir/gatsby-source-prismic-graphql#176
gatsbyjs/gatsby#22645
Output of yarn why graphql
:
$ yarn why graphql
yarn why v1.22.4
[1/4] Why do we have the module "graphql"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "graphql"
info Reasons this module exists
- "workspace-aggregator-b6900ab3-b030-4197-a37e-fa5763949305" depends on it
- Hoisted from "_project_#gatsby-theme-prismic-blog#gatsby#graphql"
- Hoisted from "_project_#gatsby-theme-prismic-core#gatsby-source-prismic-graphql#gatsby-source-graphql#graphql"
info Disk size without dependencies: "3.06MB"
info Disk size with unique dependencies: "3.16MB"
info Disk size with transitive dependencies: "3.16MB"
info Number of shared dependencies: 1
=> Found "gatsby-source-graphql-universal#[email protected]"
info This module exists because "_project_#gatsby-theme-prismic-core#gatsby-source-prismic-graphql#gatsby-source-graphql-universal" depends on it.
info Disk size without dependencies: "3.18MB"
info Disk size with unique dependencies: "3.18MB"
info Disk size with transitive dependencies: "3.18MB"
info Number of shared dependencies: 0
=> Found "@types/graphql#[email protected]"
info This module exists because "_project_#gatsby-theme-prismic-core#gatsby-source-prismic-graphql#gatsby-source-graphql-universal#@types#graphql" depends on it.
info Disk size without dependencies: "3.18MB"
info Disk size with unique dependencies: "3.18MB"
info Disk size with transitive dependencies: "3.18MB"
info Number of shared dependencies: 0
Done in 1.19s.
Looking at the source for the latest version of this package (3.1.11) in node_modules/ (which, weirdly, doesn't appear to be in sync with this repo), the given version for graphql is "*" which seems wrong?
My workaround is to delete node_modules/ and yarn.lock, then add a resolution to package.json in the project root (or workspaces root if that is your set-up):
"resolutions": {
"graphql": "^14.6.0"
}
Then reinstall with yarn
.
Thanks -
Edit: Expanding on workaround.
Hi,
I see gatsby-source-graphql-universal
version 3.1.11
here but I don't found this version in GitHub repository : https://github.com/birkir/gatsby-source-graphql-universal/blob/master/package.json#L4
Where is the 3.1.11
source code ?
Best regards,
Stéphane
The code assumes the query is at the first index:
https://github.com/birkir/gatsby-source-graphql-universal/blob/master/src/index.js#L68
This cause some preview issues in the gatsby-source-prismic-graphql.
The recent release, 3.4.0
is causing issues while installing/using gatsby-source-prismic-graphql
.
The issue has been reported here: birkir/gatsby-source-prismic-graphql#217
The last commit caused the issue because third-party
folder is missing in the package definition.
This is only a high-level assessment, as I am new to node and gatsby. Please let me know if you need more information.
Add a script to pull from upstream
The most recent changes from this PR (gatsbyjs/gatsby#15875) seem to have broken the babel-loader and it is not throwing the following errors:
TypeError: Cannot read property 'plugins' of undefined
at prepareOptions (.../node_modules/gatsby/dist/utils/babel-loader-helpers.js:62:35)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.