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-source-wordpress: ERROR #11321 after upgrading WPGraphQL to 1.14.0 #37729

Closed
2 tasks done
Haldaug opened this issue Mar 9, 2023 · 16 comments · Fixed by #37749
Closed
2 tasks done

Gatsby-source-wordpress: ERROR #11321 after upgrading WPGraphQL to 1.14.0 #37729

Haldaug opened this issue Mar 9, 2023 · 16 comments · Fixed by #37749
Assignees
Labels
topic: source-wordpress Related to Gatsby's integration with WordPress type: bug An issue or pull request relating to a bug in Gatsby

Comments

@Haldaug
Copy link

Haldaug commented Mar 9, 2023

Preliminary Checks

Description

An error occurs during parallel query running after upgrading the Word Press plugin WPGraphQL to 1.14.0, failing the build. I suspect that the update included some breaking changes for gatsby-source-wordpress.

Everything works as expected after downgrading back to 1.13.1

Reproduction Link

/

Steps to Reproduce

  1. Upgrade WPGraphQL from 1.13.10 to 1.14.0
  2. Run a clean build

Expected Result

A successful build

Actual Result

I get the following error:
ERROR #11321 API.NODE.EXECUTION "gatsby-node.js" threw an error while running the createPages lifecycle: Interface field WpConnectionType.nodes expected but WpEnqueuedScriptConnectionType does not provide it. Interface field WpConnectionType.nodes expected but WpEnqueuedStylesheetConnectionType does not provide it. Interface field WpConnectionType.nodes expected but WpActionMonitorActionConnectionType does not provide it. Interface field WpConnectionType.nodes expected but WpPluginConnectionType does not provide it. Interface field WpConnectionType.nodes expected but WpThemeConnectionType does not provide it.

You can find an example of a failed build here: https://www.gatsbyjs.com/dashboard/2ed6779b-2fc9-4c4f-b7db-3aac04ebbde8/sites/cef43953-59d5-4aa4-862b-7a8d057182ef/builds/697abd16-42d4-46d8-a1a3-d80b30d3471d/details?returnTo=%2Fdashboard%2F2ed6779b-2fc9-4c4f-b7db-3aac04ebbde8%2Fsites%2Fcef43953-59d5-4aa4-862b-7a8d057182ef%2FcmsPreview#rawLogs

Environment

System:
    OS: Linux 5.10 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1260P
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 19.3.0 - ~/.nvm/versions/node/v19.3.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.2.0 - ~/.nvm/versions/node/v19.3.0/bin/npm
  npmPackages:
    gatsby: ^5.0.1 => 5.7.0 
    gatsby-plugin-algolia: ^1.0.0 => 1.0.3 
    gatsby-plugin-exclude: ^1.0.2 => 1.0.2 
    gatsby-plugin-feed: ^5.1.0 => 5.7.0 
    gatsby-plugin-gatsby-cloud: ^5.1.0 => 5.7.0 
    gatsby-plugin-google-gtag: ^5.1.0 => 5.7.0 
    gatsby-plugin-image: ^3.1.0 => 3.7.0 
    gatsby-plugin-manifest: ^5.1.0 => 5.7.0 
    gatsby-plugin-no-sourcemaps: ^5.1.0 => 5.7.0 
    gatsby-plugin-perf-budgets: ^0.0.18 => 0.0.18 
    gatsby-plugin-postcss: ^6.1.0 => 6.7.0 
    gatsby-plugin-react-svg: ^3.3.0 => 3.3.0 
    gatsby-plugin-sharp: ^5.1.0 => 5.7.0 
    gatsby-plugin-sitemap: ^6.1.0 => 6.7.0 
    gatsby-plugin-webpack-bundle-analyser-v2: ^1.1.30 => 1.1.30 
    gatsby-source-filesystem: ^5.1.0 => 5.7.0 
    gatsby-source-wordpress: ^7.2.3 => 7.7.0 
    gatsby-transformer-sharp: ^5.1.0 => 5.7.0 
  npmGlobalPackages:
    gatsby-cli: 5.3.1

Config Flags

No response

@Haldaug Haldaug added the type: bug An issue or pull request relating to a bug in Gatsby label Mar 9, 2023
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Mar 9, 2023
@pieh pieh added topic: source-wordpress Related to Gatsby's integration with WordPress and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Mar 10, 2023
@mrcsmcln
Copy link

This exact issue is happening for me as well.

@mikeriley131
Copy link
Contributor

mikeriley131 commented Mar 11, 2023

Same, I just started getting this yesterday after making no changes other than the WP GraphQL upgrade to 1.14.0.
Rolling back to 1.13.10 resolves the issue.

@kylelondonuk
Copy link

Same issue for me. Will roll back to 1.13.10

@TylerBarnes
Copy link
Contributor

It appears to be a problem with the way source-wordpress is caching the remote schema. Certain types are omitted by default (because they don't work in Gatsby) but those types are only being omitted on the initial build and then are included in cached builds. When they're included they then break the schema because they're not properly implementing their interfaces since those types weren't supposed to exist anyway.

I've added some logic to catch when the generated schema doesn't match the previous schema and fail the build with a helpful error and type diffs, so that this will be more obvious in the future if it happens again. I'm also fixing the issue though and I should have a PR up tomorrow or the next day

@TylerBarnes
Copy link
Contributor

I have a PR open fixing this ☝️ and there's a canary available as gatsby-source-wordpress@7.8.0-alpha-wp-inconsistent-schema.29 for anyone who needs it asap!

@TylerBarnes
Copy link
Contributor

I marked the PR to be back ported for Gatsby 4 & 5 but check my previous comment for anyone who needs the fix right away

louiechristie pushed a commit to louiechristie/blog that referenced this issue Mar 27, 2023
Fix for this error...

Error: Interface field WpConnectionType.nodes expected but WpEnqueuedScriptConnectionType does not provide it.

Temporarily using gatsby-source-wordpress@7.8.0-alpha-wp-inconsistent-schema.29 because of
gatsbyjs/gatsby#37729 (comment)"
@DanielRiveraHQ
Copy link

DanielRiveraHQ commented Apr 28, 2023

I tried this, and the issue persists. On a fresh build, some nodes are missing, but if I go to Wordpress and save the content missing while I'm running gatsby development, it appears. @TylerBarnes

@TylerBarnes
Copy link
Contributor

@DanielRiveraHQ are you able to share a reproduction with me? Sharing it privately works too (tyler@gatsbyjs.com)

@dishpanda
Copy link

Thanks for the canary fix, worked for me!

@philJohnson
Copy link

@TylerBarnes I'm also getting this issue. Looking at getting a reproduction however I've found that the issue occurs specifically when I exclude types in my config. I've attached the config below.

{
      resolve: `gatsby-source-wordpress`,
      options: {
        url: process.env.GATSBY_GRAPHQL_API_URL,
        schema: {
          timeout: 60000,
          perPage: 50,
          requestConcurrency: 15,
          previewRequestConcurrency: 5
        },
        html: {
          useGatsbyImage: false,
          createStaticFiles: false
        },
        type: {
          MediaItem: {
            createFileNodes: false
          },
           UserRole: {
             exclude: true
           },
           Comment: {
             exclude: true
          }
        },
        develop: {
          hardCacheMediaFiles: true
        }
      }
    },
    ```
    
 If I include comments and user roles then I no longer get an issue.

@DanielRiveraHQ
Copy link

@philJohnson I'll check if that solution works! 🙏

@ibjorn
Copy link

ibjorn commented Sep 9, 2023

@TylerBarnes I'm also getting this issue. Looking at getting a reproduction however I've found that the issue occurs specifically when I exclude types in my config. I've attached the config below.

{
      resolve: `gatsby-source-wordpress`,
      options: {
        url: process.env.GATSBY_GRAPHQL_API_URL,
        schema: {
          timeout: 60000,
          perPage: 50,
          requestConcurrency: 15,
          previewRequestConcurrency: 5
        },
        html: {
          useGatsbyImage: false,
          createStaticFiles: false
        },
        type: {
          MediaItem: {
            createFileNodes: false
          },
           UserRole: {
             exclude: true
           },
           Comment: {
             exclude: true
          }
        },
        develop: {
          hardCacheMediaFiles: true
        }
      }
    },
    ```
    
 If I include comments and user roles then I no longer get an issue.

Removing type: {...} entirely worked for me. I was only using it for excludes anyway.

@maghaffar
Copy link

I have a PR open fixing this ☝️ and there's a canary available as gatsby-source-wordpress@7.8.0-alpha-wp-inconsistent-schema.29 for anyone who needs it asap!

I am still getting this error in 2024. Did'nt you resolved the issue?. I have upgraded my WPGraphql version and after that I am getting the error.
Do we have a permanent solution?

@maghaffar
Copy link

maghaffar commented Apr 25, 2024

@TylerBarnes Please help me in resolving this. I want a permanent solution rather than changing my gatsby-source-wordpress version to the specific version you mentioned above

@TylerBarnes
Copy link
Contributor

@maghaffar I'm not maintaining this repo anymore but the fix was released in Gatsby 4 and 5 nearly a year ago

@maghaffar
Copy link

@TylerBarnes Can you please mention who is maintaining the repo. I think that the it is needed to fix this again with WPGraphql 1.24.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: source-wordpress Related to Gatsby's integration with WordPress 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.