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

Gatsby 5 compatibility #95

Closed
ThijmenDeValk opened this issue Nov 23, 2022 · 1 comment
Closed

Gatsby 5 compatibility #95

ThijmenDeValk opened this issue Nov 23, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@ThijmenDeValk
Copy link

Description

When using this plugin with Gatsby 5, you instantly get an error stating visitFn.call is not a function. The stack trace seems to suggest this is a pretty low level issue with gatsby-graphql-source-toolkit. My guess is it's fixed by gatsbyjs/gatsby-graphql-toolkit#48, but that's not yet merged by Gatsby.

Stack trace

 ERROR #11321  PLUGIN

"gatsby-source-craft" threw an error while running the createSchemaCustomization lifecycle:

visitFn.call is not a function

  570 |     const schema = await getSchema();
  571 |     const gatsbyNodeTypes = await getGatsbyNodeTypes(gatsbyApi.reporter);
> 572 |     const documents = await compileNodeQueries({
      |                             ^
  573 |         schema,
  574 |         gatsbyNodeTypes,
  575 |         customFragments: await collectFragments(),

File: node_modules/gatsby-source-craft/gatsby-node.js:572:29
  TypeError: visitFn.call is not a function
  
  - compile-node-queries.ts:149 compileDocument
    [my-gatsby-site]/[gatsby-graphql-source-toolkit]/src/compile-node-queries/compile-node-queries.ts:149:10
  
  - compile-node-queries.ts:73 
    [my-gatsby-site]/[gatsby-graphql-source-toolkit]/src/compile-node-queries/compile-node-queries.ts:73:17
  
  - Array.forEach
  
  - compile-node-queries.ts:72 compileNodeQueries
    [my-gatsby-site]/[gatsby-graphql-source-toolkit]/src/compile-node-queries/compile-node-queries.ts:72:24
  
  - gatsby-node.js:572 getSourcingConfig
    [my-gatsby-site]/[gatsby-source-craft]/gatsby-node.js:572:29
  
  - gatsby-node.js:368 Object.exports.createSchemaCustomization
    [my-gatsby-site]/[gatsby-source-craft]/gatsby-node.js:368:20
  
  - api-runner-node.js:487 runAPI
    [my-gatsby-site]/[gatsby]/src/utils/api-runner-node.js:487:16

Steps to reproduce

  1. Create new Gatsby 5 project
  2. Install and configure gatsby-source-craft
  3. Run npm run develop

Example repo

https://github.com/ThijmenDeValk/gatsby-source-craft-error-proof

Additional info

  • Gatsby version: 5.1.0
  • gatsby-source-craft version: 3.0.0
  • Node version: 18.12.1
  • Craft version: 4.3.3
  • Gatsby Helper version: 2.0.0
@ThijmenDeValk ThijmenDeValk added the bug Something isn't working label Nov 23, 2022
@ThijmenDeValk ThijmenDeValk changed the title visitFn.call is not a function on Gatsby 5 Gatsby 5 compatibility Nov 23, 2022
@ThijmenDeValk
Copy link
Author

ThijmenDeValk commented Nov 23, 2022

Well, that was quick. Gatsby-graphql-toolkit v2.0.3 fixes this issue. So now all that's needed to use this with Gatsby 5 is the --legacy-peer-deps flag until official support is added to this repo (I'll make a pull request for that soon).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant