Yet another RangeError: Maximum call stack size exceeded error, gatsby-source-contentful edition

Site name: karbon-mkt-stage.netlify.app (also happens on karbon-mkt-live.netlify.app)

    "gatsby": "5.12.6",
    "gatsby-source-contentful": "8.12.2",
     ...

We are having an intermittent problem building our Gatsby 5 site when the cache is warm - clearing cache and rebuilding always works fine.

Quite often gatsby-source-contentful will throw a callstack error directly after it has finished its Sync.

This issue has only started since upgrading to Gatsby 5 so I’m guess ing it as somethign to do with whatever gatsby-source-contentful does in the Process data step directly after sourcing.

────────────────Build log for a failed deploy────────────────

9:58:44 AM: buildbot version: e72f97b8392bc9840ee1dc53b4c20f16b787bac7
9:58:44 AM: Fetching cached dependencies
9:58:44 AM: Starting to download cache of 803.2MB
9:58:52 AM: Finished downloading cache in 7.905s
9:58:52 AM: Starting to extract cache
9:58:59 AM: Finished extracting cache in 6.849s
9:58:59 AM: Finished fetching cache in 14.944s
9:58:59 AM: Starting to prepare the repo for build
9:59:00 AM: Preparing Git Reference pull/2155/head
9:59:01 AM: Custom build command detected. Proceeding with the specified command: "npm run build && cat static/_redirects.live >> public/_redirects"
9:59:02 AM: Starting to install dependencies
9:59:02 AM: Python version set to 3.8
9:59:02 AM: Attempting Ruby version 2.6.2, read from environment
9:59:02 AM: Started restoring cached Ruby version
9:59:02 AM: Finished restoring cached Ruby version
9:59:02 AM: Using Ruby version 2.6.2
9:59:03 AM: Started restoring cached go cache
9:59:03 AM: Finished restoring cached go cache
9:59:03 AM: Installing Go version 1.12 (requested 1.12)
9:59:07 AM: go version go1.12 linux/amd64
9:59:08 AM: Using PHP version 8.0
9:59:09 AM: Started restoring cached Node.js version
9:59:09 AM: Finished restoring cached Node.js version
9:59:09 AM: Attempting Node.js version "20" from .nvmrc
9:59:10 AM: v20.9.0 is already installed.
9:59:10 AM: Now using node v20.9.0 (npm v10.1.0)
9:59:10 AM: Enabling Node.js Corepack
9:59:10 AM: Started restoring cached build plugins
9:59:10 AM: Finished restoring cached build plugins
9:59:10 AM: WARNING: The environment variable "NODE_ENV" is set to "production". Any "devDependencies" in package.json will not be installed
9:59:10 AM: Started restoring cached corepack dependencies
9:59:10 AM: Finished restoring cached corepack dependencies
9:59:10 AM: No npm workspaces detected
9:59:10 AM: Started restoring cached node modules
9:59:10 AM: Finished restoring cached node modules
9:59:10 AM: Installing npm packages using npm version 10.1.0
9:59:14 AM: npm WARN ERESOLVE overriding peer dependency
9:59:14 AM: npm WARN While resolving: eslint-config-react-app@6.0.0
9:59:14 AM: npm WARN Found: @typescript-eslint/eslint-plugin@5.62.0
9:59:14 AM: npm WARN node_modules/@typescript-eslint/eslint-plugin
9:59:14 AM: npm WARN   dev @typescript-eslint/eslint-plugin@"^5.62.0" from the root project
9:59:14 AM: npm WARN   1 more (gatsby)
9:59:14 AM: npm WARN
9:59:14 AM: npm WARN Could not resolve dependency:
9:59:14 AM: npm WARN peer @typescript-eslint/eslint-plugin@"^4.0.0" from eslint-config-react-app@6.0.0
9:59:14 AM: npm WARN node_modules/eslint-config-react-app
9:59:14 AM: npm WARN   eslint-config-react-app@"^6.0.0" from gatsby@5.12.6
9:59:14 AM: npm WARN   node_modules/gatsby
9:59:14 AM: npm WARN
9:59:14 AM: npm WARN Conflicting peer dependency: @typescript-eslint/eslint-plugin@4.33.0
9:59:14 AM: npm WARN node_modules/@typescript-eslint/eslint-plugin
9:59:14 AM: npm WARN   peer @typescript-eslint/eslint-plugin@"^4.0.0" from eslint-config-react-app@6.0.0
9:59:14 AM: npm WARN   node_modules/eslint-config-react-app
9:59:14 AM: npm WARN     eslint-config-react-app@"^6.0.0" from gatsby@5.12.6
9:59:14 AM: npm WARN     node_modules/gatsby
9:59:14 AM: npm WARN ERESOLVE overriding peer dependency
9:59:14 AM: npm WARN While resolving: eslint-config-react-app@6.0.0
9:59:14 AM: npm WARN Found: @typescript-eslint/parser@5.62.0
9:59:14 AM: npm WARN node_modules/@typescript-eslint/parser
9:59:14 AM: npm WARN   dev @typescript-eslint/parser@"^5.62.0" from the root project
9:59:14 AM: npm WARN   2 more (@typescript-eslint/eslint-plugin, gatsby)
9:59:14 AM: npm WARN
9:59:14 AM: npm WARN Could not resolve dependency:
9:59:14 AM: npm WARN peer @typescript-eslint/parser@"^4.0.0" from eslint-config-react-app@6.0.0
9:59:14 AM: npm WARN node_modules/eslint-config-react-app
9:59:14 AM: npm WARN   eslint-config-react-app@"^6.0.0" from gatsby@5.12.6
9:59:14 AM: npm WARN   node_modules/gatsby
9:59:14 AM: npm WARN
9:59:14 AM: npm WARN Conflicting peer dependency: @typescript-eslint/parser@4.33.0
9:59:14 AM: npm WARN node_modules/@typescript-eslint/parser
9:59:14 AM: npm WARN   peer @typescript-eslint/parser@"^4.0.0" from eslint-config-react-app@6.0.0
9:59:14 AM: npm WARN   node_modules/eslint-config-react-app
9:59:14 AM: npm WARN     eslint-config-react-app@"^6.0.0" from gatsby@5.12.6
9:59:14 AM: npm WARN     node_modules/gatsby
9:59:14 AM: npm WARN ERESOLVE overriding peer dependency
9:59:14 AM: npm WARN While resolving: eslint-config-react-app@6.0.0
9:59:14 AM: npm WARN Found: eslint@8.52.0
9:59:14 AM: npm WARN node_modules/eslint
9:59:14 AM: npm WARN   dev eslint@"^8.47.0" from the root project
9:59:14 AM: npm WARN   21 more (@babel/eslint-parser, ...)
9:59:14 AM: npm WARN
9:59:14 AM: npm WARN Could not resolve dependency:
9:59:14 AM: npm WARN peer eslint@"^7.5.0" from eslint-config-react-app@6.0.0
9:59:14 AM: npm WARN node_modules/eslint-config-react-app
9:59:14 AM: npm WARN   eslint-config-react-app@"^6.0.0" from gatsby@5.12.6
9:59:14 AM: npm WARN   node_modules/gatsby
9:59:14 AM: npm WARN
9:59:14 AM: npm WARN Conflicting peer dependency: eslint@7.32.0
9:59:14 AM: npm WARN node_modules/eslint
9:59:14 AM: npm WARN   peer eslint@"^7.5.0" from eslint-config-react-app@6.0.0
9:59:14 AM: npm WARN   node_modules/eslint-config-react-app
9:59:14 AM: npm WARN     eslint-config-react-app@"^6.0.0" from gatsby@5.12.6
9:59:14 AM: npm WARN     node_modules/gatsby
9:59:14 AM: npm WARN ERESOLVE overriding peer dependency
9:59:14 AM: npm WARN While resolving: eslint-plugin-flowtype@5.10.0
9:59:14 AM: npm WARN Found: eslint@8.52.0
9:59:14 AM: npm WARN node_modules/eslint
9:59:14 AM: npm WARN   dev eslint@"^8.47.0" from the root project
9:59:14 AM: npm WARN   21 more (@babel/eslint-parser, ...)
9:59:14 AM: npm WARN
9:59:14 AM: npm WARN Could not resolve dependency:
9:59:14 AM: npm WARN peer eslint@"^7.1.0" from eslint-plugin-flowtype@5.10.0
9:59:14 AM: npm WARN node_modules/eslint-plugin-flowtype
9:59:14 AM: npm WARN   peer eslint-plugin-flowtype@"^5.2.0" from eslint-config-react-app@6.0.0
9:59:14 AM: npm WARN   node_modules/eslint-config-react-app
9:59:14 AM: npm WARN   1 more (gatsby)
9:59:14 AM: npm WARN
9:59:14 AM: npm WARN Conflicting peer dependency: eslint@7.32.0
9:59:14 AM: npm WARN node_modules/eslint
9:59:14 AM: npm WARN   peer eslint@"^7.1.0" from eslint-plugin-flowtype@5.10.0
9:59:14 AM: npm WARN   node_modules/eslint-plugin-flowtype
9:59:14 AM: npm WARN     peer eslint-plugin-flowtype@"^5.2.0" from eslint-config-react-app@6.0.0
9:59:14 AM: npm WARN     node_modules/eslint-config-react-app
9:59:14 AM: npm WARN     1 more (gatsby)
9:59:14 AM: npm WARN ERESOLVE overriding peer dependency
9:59:14 AM: npm WARN While resolving: stylelint-order@5.0.0
9:59:14 AM: npm WARN Found: stylelint@15.11.0
9:59:14 AM: npm WARN node_modules/stylelint
9:59:14 AM: npm WARN   dev stylelint@"^15.10.3" from the root project
9:59:14 AM: npm WARN   3 more (stylelint-config-css-modules, ...)
9:59:14 AM: npm WARN
9:59:14 AM: npm WARN Could not resolve dependency:
9:59:14 AM: npm WARN peer stylelint@"^14.0.0" from stylelint-order@5.0.0
9:59:14 AM: npm WARN node_modules/stylelint-order
9:59:14 AM: npm WARN   stylelint-order@"^5.0.0" from stylelint-config-idiomatic-order@9.0.0
9:59:14 AM: npm WARN   node_modules/stylelint-config-idiomatic-order
9:59:14 AM: npm WARN
9:59:14 AM: npm WARN Conflicting peer dependency: stylelint@14.16.1
9:59:14 AM: npm WARN node_modules/stylelint
9:59:14 AM: npm WARN   peer stylelint@"^14.0.0" from stylelint-order@5.0.0
9:59:14 AM: npm WARN   node_modules/stylelint-order
9:59:14 AM: npm WARN     stylelint-order@"^5.0.0" from stylelint-config-idiomatic-order@9.0.0
9:59:14 AM: npm WARN     node_modules/stylelint-config-idiomatic-order
9:59:17 AM: up to date, audited 2534 packages in 6s
9:59:17 AM: 474 packages are looking for funding
9:59:17 AM:   run `npm fund` for details
9:59:17 AM: 8 moderate severity vulnerabilities
9:59:17 AM: To address all issues possible (including breaking changes), run:
9:59:17 AM:   npm audit fix --force
9:59:17 AM: Some issues need review, and may require choosing
9:59:17 AM: a different dependency.
9:59:17 AM: Run `npm audit` for details.
9:59:17 AM: npm packages installed
9:59:17 AM: Successfully installed dependencies
9:59:17 AM: Starting build script
9:59:18 AM: Detected 1 framework(s)
9:59:18 AM: "gatsby" at version "5.12.6"
9:59:18 AM: Section completed: initializing
9:59:20 AM: ​
9:59:20 AM: Netlify Build                                                 
9:59:20 AM: ────────────────────────────────────────────────────────────────
9:59:20 AM: ​
9:59:20 AM: ❯ Version
9:59:20 AM:   @netlify/build 29.24.3
9:59:20 AM: ​
9:59:20 AM: ❯ Flags
9:59:20 AM:   baseRelDir: true
9:59:20 AM:   buildId: 654802036a50c800088f3028
9:59:20 AM:   deployId: 654802036a50c800088f302a
9:59:20 AM: ​
9:59:20 AM: ❯ Current directory
9:59:20 AM:   /opt/build/repo
9:59:20 AM: ​
9:59:20 AM: ❯ Config file
9:59:20 AM:   /opt/build/repo/netlify.toml
9:59:20 AM: ​
9:59:20 AM: ❯ Context
9:59:20 AM:   deploy-preview
9:59:20 AM: ​
9:59:20 AM: ❯ Loading plugins
9:59:20 AM:    - @netlify/plugin-gatsby@3.7.2 from Netlify app
9:59:20 AM:    - @netlify/plugin-lighthouse@5.0.0 from netlify.toml
9:59:20 AM:    - netlify-plugin-subfont@6.0.0 from netlify.toml
9:59:22 AM: ​
9:59:22 AM: @netlify/plugin-gatsby (onPreBuild event)                     
9:59:22 AM: ────────────────────────────────────────────────────────────────
9:59:22 AM: ​
9:59:22 AM: Skipping @netlify/plugin-gatsby work, because used Gatsby version supports adapters.
9:59:22 AM: ​
9:59:22 AM: (@netlify/plugin-gatsby onPreBuild completed in 54ms)
9:59:22 AM: ​
9:59:22 AM: build.command from netlify.toml                               
9:59:22 AM: ────────────────────────────────────────────────────────────────
9:59:22 AM: ​
9:59:22 AM: $ npm run build && cat static/_redirects.live >> public/_redirects
9:59:22 AM: > karbon-marketing-static@5.0.0 prebuild
9:59:22 AM: > node ./tasks/checkArch.js && node ./tasks/preBuild.js
9:59:22 AM: > karbon-marketing-static@5.0.0 build
9:59:22 AM: > gatsby build --prefix-paths
9:59:25 AM: success compile gatsby files - 1.457s
9:59:25 AM: info The following flags are active:
9:59:25 AM: - PRESERVE_FILE_DOWNLOAD_CACHE · (Umbrella Issue (https://gatsby.dev/cache-clearing-feedback)) · Don"t delete the downloaded files cache when changing gatsby-node.js & gatsby-config.js files.
9:59:25 AM: There are 2 other flags available that you might be interested in:
9:59:25 AM: - DETECT_NODE_MUTATIONS · Diagnostic mode to log any attempts to mutate node directly. Helpful when debugging missing data problems. See https://gatsby.dev/debugging-missing-data for more details.
9:59:25 AM: - PARTIAL_HYDRATION · EXPERIMENTAL · (Umbrella Issue (https://gatsby.dev/partial-hydration-umbrella-issue)) · Enable partial hydration to reduce Total Blocking Time and Time To Interactive
9:59:25 AM: success load gatsby config - 0.035s
9:59:25 AM: info Using gatsby-adapter-netlify adapter
9:59:27 AM: success load plugins - 0.799s
9:59:27 AM: warning gatsby-plugin-react-helmet: Gatsby now has built-in support for modifying the document head. Learn more at https://gatsby.dev/gatsby-head
9:59:27 AM: success onPreInit - 0.005s
9:59:27 AM: success delete worker cache from previous builds - 0.001s
9:59:27 AM: success initialize cache - 0.032s
9:59:28 AM: success copy gatsby files - 0.103s
9:59:30 AM: success Compiling Gatsby Functions - 2.171s
9:59:30 AM: success onPreBootstrap - 2.182s
9:59:30 AM: success createSchemaCustomization - 0.585s
9:59:38 AM: success Contentful: Sync changed items - 0.331s - 90/90 271.75/s
9:59:38 AM: success Contentful: Fetch data - 0.982s
9:59:38 AM: info Contentful: 0 new entries
9:59:38 AM: info Contentful: 90 updated entries
9:59:38 AM: info Contentful: 0 deleted entries
9:59:38 AM: info Contentful: 6858.666666666667 cached entries
9:59:38 AM: info Contentful: 0 new assets
9:59:38 AM: info Contentful: 0 updated assets
9:59:38 AM: info Contentful: 3418 cached assets
9:59:38 AM: info Contentful: 0 deleted assets
9:59:39 AM: info Creating 2 Contentful Article Page nodes
9:59:39 AM: info Creating 4 Contentful Event data nodes
9:59:39 AM: info Creating 84 Contentful Template nodes
9:59:39 AM: success Contentful: Process data - 1.298s
9:59:39 AM: success Contentful: Create nodes - 0.479s
9:59:39 AM: error "gatsby-source-contentful" threw an error while running the sourceNodes lifecycle:
9:59:39 AM: Maximum call stack size exceeded
9:59:39 AM: 
9:59:39 AM: 
9:59:39 AM:   RangeError: Maximum call stack size exceeded
9:59:39 AM:   
9:59:39 AM:   - pack.js:231 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:231:16
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:228 packArray
9:59:39 AM:     [repo]/[msgpackr]/pack.js:228:5
9:59:39 AM:   
9:59:39 AM:   - pack.js:414 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:414:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:228 packArray
9:59:39 AM:     [repo]/[msgpackr]/pack.js:228:5
9:59:39 AM:   
9:59:39 AM:   - pack.js:414 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:414:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:228 packArray
9:59:39 AM:     [repo]/[msgpackr]/pack.js:228:5
9:59:39 AM:   
9:59:39 AM:   - pack.js:414 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:414:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:228 packArray
9:59:39 AM:     [repo]/[msgpackr]/pack.js:228:5
9:59:39 AM:   
9:59:39 AM:   - pack.js:414 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:414:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:228 packArray
9:59:39 AM:     [repo]/[msgpackr]/pack.js:228:5
9:59:39 AM:   
9:59:39 AM:   - pack.js:414 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:414:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:664 Packr.writeRecord
9:59:39 AM:     [repo]/[msgpackr]/pack.js:664:6
9:59:39 AM:   
9:59:39 AM:   - pack.js:412 pack
9:59:39 AM:     [repo]/[msgpackr]/pack.js:412:7
9:59:39 AM:   
9:59:39 AM:   - pack.js:228 packArray
9:59:39 AM:     [repo]/[msgpackr]/pack.js:228:5
9:59:39 AM:   
9:59:39 AM: 
9:59:39 AM: not finished source and transform nodes - 9.026s
9:59:40 AM: ​
9:59:40 AM: "build.command" failed                                        
9:59:40 AM: ────────────────────────────────────────────────────────────────
9:59:40 AM: ​
9:59:40 AM:   Error message
9:59:40 AM:   Command failed with exit code 1: npm run build && cat static/_redirects.live >> public/_redirects (https://ntl.fyi/exit-code-1)
9:59:40 AM: ​
9:59:40 AM:   Error location
9:59:40 AM:   In build.command from netlify.toml:
9:59:40 AM:   npm run build && cat static/_redirects.live >> public/_redirects
9:59:40 AM: ​
9:59:40 AM:   Resolved config
9:59:40 AM:   build:
9:59:40 AM:     base: /opt/build/repo
9:59:40 AM:     command: npm run build && cat static/_redirects.live >> public/_redirects
9:59:40 AM:     commandOrigin: config
9:59:40 AM:     environment:
9:59:40 AM:       - CLEARBIT_API_KEY
9:59:40 AM:       - CLOUDINARY_API_SECRET
9:59:40 AM:       - ELASTIC_API_KEY_BASE64
9:59:40 AM:       - ELASTIC_CLOUD_ID
9:59:40 AM:       - ELASTIC_INDEX
9:59:40 AM:       - GATSBY_CTF_CD_ACCESS_TOKEN
9:59:40 AM:       - GATSBY_CTF_ENV
9:59:40 AM:       - GATSBY_CTF_RELEASE_NOTES_CD_ACCESS_TOKEN
9:59:40 AM:       - GATSBY_CTF_RELEASE_NOTES_SPACE_ID
9:59:40 AM:       - GATSBY_CTF_SPACE_ID
9:59:40 AM:       - GATSBY_DEFAULT_LANGUAGE
9:59:40 AM:       - GATSBY_DEPLOY_ENV
9:59:40 AM:       - GATSBY_EXCLUDE_DATASTORE_FROM_BUNDLE
9:59:40 AM:       - GATSBY_IPSTACK_KEY
9:59:40 AM:       - GATSBY_RECAPTCHA_SITE_KEY
9:59:40 AM:       - GATSBY_SITE_URL
9:59:40 AM:       - GOOGLE_RECAPTCHA_SECRET_KEY
9:59:40 AM:       - KARBON_SUCCESS_EVENTS_TOKEN
9:59:40 AM:       - NODE_ENV
9:59:40 AM:       - NPM_TOKEN
9:59:40 AM:       - OKTOPOST_ACCOUNT_ID
9:59:40 AM:       - OSANO_CUSTOMER_CCID
9:59:40 AM:       - OSANO_CUSTOMER_ID
9:59:40 AM:       - OSANO_DEV_MODE
9:59:40 AM:       - RAMP_ACCOUNT_ID
9:59:40 AM:       - RAMP_TOKEN
9:59:40 AM:       - REVIEW_ID
9:59:40 AM:       - SEGMENT_DEV_WRITE_KEY
9:59:40 AM:       - SEGMENT_PRODUCTION_WRITE_KEY
9:59:40 AM:       - SENDGRID_API_KEY
9:59:40 AM:       - SENDGRID_EMAIL_VALIDATION_KEY
9:59:40 AM:       - SLACK_GO_WEBHOOK_URL
9:59:40 AM:       - WISTIA_API_KEY
9:59:40 AM:       - ZOOM_ACCOUNT_ID
9:59:40 AM:       - ZOOM_API_KEY
9:59:40 AM:       - ZOOM_API_SECRET
9:59:40 AM:       - ZOOM_CLIENT_ID
9:59:40 AM:       - ZOOM_CLIENT_SECRET
9:59:40 AM:     processing:
9:59:40 AM:       skip_processing: true
9:59:40 AM:     publish: /opt/build/repo/public
9:59:40 AM:     publishOrigin: config
9:59:40 AM:   functions:
9:59:40 AM:     "*":
9:59:40 AM:       node_bundler: esbuild
9:59:40 AM:   headers:
9:59:41 AM: Failed during stage "building site": Build script returned non-zero exit code: 2
9:59:41 AM:     - for: /*
      values:
        Access-Control-Allow-Origin: "*"
        Referrer-Policy: origin-when-cross-origin
  headersOrigin: config
  plugins:
    - inputs: {}
      origin: ui
      package: "@netlify/plugin-gatsby"
    - inputs: {}
      origin: config
      package: "@netlify/plugin-lighthouse"
    - inputs:
        fallbacks: true
        inlineCss: true
        inlineFonts: true
        recursive: false
      origin: config
      package: netlify-plugin-subfont
9:59:41 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:59:41 AM: Failing build: Failed to build site
9:59:41 AM: Finished processing build request in 57.177s```

This sounds more of a:

  • Gatsby issue OR
  • The Contentful source plugin issue

Both of which is not something we can help with on these forums. Feel free to file an issue on the respective repo.

Feel free to provide a minimal reproduction though, so we can make sure you’re not doing something wrong.

Yes I expect you’re probably right. Most likely a data issue of some sort.
I’ll report back any findings here.