gatsby: 5.10 is buggy with linked nodes in custom schema. They are null until cache clean and rebuild. Will eventually corrupt again.

Preliminary Checks

Description

Linked nodes in custom schema are no longer being reliably populated. Corruption is being cached. Nodes return null.

Reproduction Link

https://githubbox.com/gatsbyjs/gatsby-starter-minimal

Steps to Reproduce

  1. Create a working site, with a custom schema
            fullUrl: String
            asset: ContentfulAsset
            @link(from: "asset___NODE")
            brandfolderAsset: [contentfulImageAssetsBrandfolderAssetJsonNode]
            @link(from: "brandfolderAsset___NODE")
        }
  1. Do incremental builds in Gatsby cloud by updating content
  2. Evenutally “asset” will return null
  3. Clear cache and force a manual rebuild in Gatsby cloud, and your content is back …

Expected Result

Reliability

Actual Result

Missing fields

Environment

System:
    OS: Linux 5.15 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
    npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
  npmPackages:
    gatsby: ^5.10.0 => 5.10.0 
    gatsby-plugin-canonical-urls: ^5.10.0 => 5.10.0 
    gatsby-plugin-gatsby-cloud: ^5.10.0 => 5.10.0 
    gatsby-plugin-image: ^3.10.0 => 3.10.0 
    gatsby-plugin-node-fields: ^3.1.0 => 3.1.0 
    gatsby-plugin-react-helmet: ^6.10.0 => 6.10.0 
    gatsby-plugin-sitemap: ^6.10.0 => 6.10.0 
    gatsby-source-contentful: ^8.10.0 => 8.10.0 
  npmGlobalPackages:
    gatsby: 5.10.0

Config Flags

DEV_SSR: true

About this issue

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

Most upvoted comments

The depreciation warning is not an issue. Everyone has this using the current version of the Contentful plugin.

We have a new version coming up, it will generate the schema in the proper way Gatsby expects it.

https://github.com/gatsbyjs/gatsby/issues/31385 https://github.com/gatsbyjs/gatsby/pull/30855

The patch is public via gatsby-source-contentful@8.13.0-next.1

Can’t be happier to find this issue, haha. It’s been days we are struggling with this too.

Sometimes Gatsby builds are ok (on Gatsby Cloud or locally). But often the cache seems to get corrupted and only a manual “clear cache and restart” can solve it (it may still fail).

Details:

Node version v18.16.1
Gatsby version Gatsby CLI version: 5.11.0
Gatsby version: 5.11.0
gatsby-source-contentful: 8.11.0

Curious things that are happening in a failed build:

verbose 55.671506293 Plugin "gatsby-source-contentful" is using the ___NODE convention which is deprecated. This plugin should use the @link directive instead.

warning Multiple node fields resolve to the same GraphQL field `contentfulBrandDescriptionTextNode.description` - [`description`, `description___NODE`]. Gatsby will use `description___NODE`.

Migration: https://gatsby.dev/node-convention-deprecation

verbose 55.699907411 Plugin "null" is using the ___NODE convention which is deprecated. This plugin should use the @link directive instead.

Note the plugin “null”, that’s not appearing on a successful build.

Then it crashes on this error.

ERROR There was an error in your GraphQL query:

Field "description" of type "contentfulBrandDescriptionTextNode" must have a selection of subfields. Did you mean "description { ... }"?

In short, the graphQL schema seems to be corrupted, and the related fields are not the right match anymore.