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

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

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 5
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

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!

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 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.

@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.

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