Build starts failing after some time of inactivity

I’ve recently performed a trivial change to my repo, and the build is not longer green. To be sure it wasn’t the code I wrote, I also deployed a PR force pushing the latest green commit, and it doesn’t succeed either.

Running bun run build locally builds the project just fine.

The app name is: adms-admin

Latest green build (main branch):

buildId: 66130f7a6a2d92000816dbd9
deployId: 66130f7a6a2d92000816dbdb

Latest red build (main branch):

buildId: 6632cd466ab1fe0009593fc2
deployId: 6632cd466ab1fe0009593fc4

BUILDING ERROR LOG:

1:16:36 AM: build-image version: 3d3c7e8b4321e2c1a54a2c4584fb46ba742b1630 (focal)
1:16:36 AM: buildbot version: d85d718afb4cfc1d31fb4837470daa2b526f928f
1:16:36 AM: Fetching cached dependencies
1:16:36 AM: Starting to download cache of 351.9MB
1:16:38 AM: Finished downloading cache in 2.529s
1:16:38 AM: Starting to extract cache
1:16:44 AM: Finished extracting cache in 5.644s
1:16:44 AM: Finished fetching cache in 8.236s
1:16:44 AM: Starting to prepare the repo for build
1:16:44 AM: Preparing Git Reference refs/heads/main
1:16:46 AM: Custom functions path detected. Proceeding with the specified path: 'api'
1:16:47 AM: Starting to install dependencies
1:16:47 AM: Python version set to 3.8
1:16:47 AM: Attempting Ruby version 2.7.2, read from environment
1:16:48 AM: Using Ruby version 2.7.2
1:16:48 AM: Started restoring cached go cache
1:16:48 AM: Finished restoring cached go cache
1:16:50 AM: go version go1.19.13 linux/amd64
1:16:50 AM: Using PHP version 8.0
1:16:52 AM: Started restoring cached Node.js version
1:16:53 AM: Finished restoring cached Node.js version
1:16:54 AM: Downloading and installing node v18.20.2...
1:16:54 AM: Downloading https://nodejs.org/dist/v18.20.2/node-v18.20.2-linux-x64.tar.xz...
1:16:54 AM: Computing checksum with sha256sum
1:16:54 AM: Checksums matched!
1:16:56 AM: Enabling Node.js Corepack
1:16:56 AM: Started restoring cached build plugins
1:16:56 AM: Finished restoring cached build plugins
1:16:56 AM: Started restoring cached corepack dependencies
1:16:56 AM: Finished restoring cached corepack dependencies
1:16:56 AM: Started restoring cached bun global cache
1:16:56 AM: Finished restoring cached bun global cache
1:16:56 AM: Installing npm packages using bun version 1.1.4
1:16:56 AM: [0.88ms] ".env.production", ".env"
1:16:56 AM: bun install v1.1.4 (fbe2fe0c)
1:16:58 AM:  Saved lockfile
1:16:58 AM:  + @graphql-codegen/add@5.0.2
1:16:58 AM:  + @graphql-codegen/cli@5.0.2
1:16:58 AM:  + @graphql-codegen/client-preset@4.2.5
1:16:58 AM:  + @graphql-codegen/introspection@4.0.3
1:16:58 AM:  + @graphql-codegen/typescript-apollo-client-helpers@3.0.0
1:16:58 AM:  + @graphql-inspector/cli@4.0.3
1:16:58 AM:  + @parcel/watcher@2.4.1
1:16:58 AM:  + @playwright/test@1.43.1
1:16:58 AM:  + @tanstack/router-devtools@1.31.5
1:16:58 AM:  + @total-typescript/ts-reset@0.5.1
1:16:58 AM:  + @types/leaflet@1.9.12
1:16:58 AM:  + @types/react@18.3.1
1:16:58 AM:  + @types/react-dom@18.3.0
1:16:58 AM:  + @typescript-eslint/eslint-plugin@5.62.0
1:16:58 AM:  + @typescript-eslint/parser@5.62.0
1:16:58 AM:  + @vitejs/plugin-react-swc@3.6.0
1:16:58 AM:  + autoprefixer@10.4.19
1:16:58 AM:  + codegen@0.1.0
1:16:58 AM:  + eslint@8.57.0
1:16:58 AM:  + eslint-config-airbnb@19.0.4
1:16:58 AM:  + eslint-config-airbnb-typescript@17.1.0
1:16:58 AM:  + eslint-config-prettier@8.10.0
1:16:58 AM:  + eslint-plugin-functional@4.4.1
1:16:58 AM:  + eslint-plugin-import@2.29.1
1:16:58 AM:  + eslint-plugin-jsx-a11y@6.8.0
1:16:58 AM:  + eslint-plugin-prettier@4.2.1
1:16:58 AM:  + eslint-plugin-react@7.34.1
1:16:58 AM:  + eslint-plugin-react-hooks@4.6.2
1:16:58 AM:  + eslint-plugin-react-refresh@0.4.6
1:16:58 AM:  + eslint-plugin-unused-imports@3.2.0
1:16:58 AM:  + graphql-codegen-typescript-validation-schema@0.12.1
1:16:58 AM:  + graphql-inspector@0.5.1
1:16:58 AM:  + npm-run-all@4.1.5
1:16:58 AM:  + postcss@8.4.38
1:16:58 AM:  + prettier@2.8.8
1:16:58 AM:  + prettier-plugin-organize-imports@3.2.4
1:16:58 AM:  + tailwindcss@3.4.3
1:16:58 AM:  + ts-node@10.9.2
1:16:58 AM:  + typescript@5.4.5
1:16:58 AM:  + vite@5.2.10
1:16:58 AM:  + vite-plugin-checker@0.6.4
1:16:58 AM:  + vite-plugin-restart@0.4.0
1:16:58 AM:  + vitest@1.5.3
1:16:58 AM:  + @apollo/client@3.10.1
1:16:58 AM:  + @emotion/react@11.11.4
1:16:58 AM:  + @emotion/styled@11.11.5
1:16:58 AM:  + @hookform/resolvers@3.3.4
1:16:58 AM:  + @mui/joy@5.0.0-beta.36
1:16:58 AM:  + @netlify/functions@2.6.0
1:16:58 AM:  + @nhost/react@3.4.1
1:16:58 AM:  + @tanstack/react-router@1.31.5
1:16:58 AM:  + ag-grid-community@31.3.1
1:16:58 AM:  + ag-grid-enterprise@31.3.1
1:16:58 AM:  + ag-grid-react@31.3.1
1:16:58 AM:  + axios@1.6.8
1:16:58 AM:  + classnames@2.5.1
1:16:58 AM:  + dayjs@1.11.11
1:16:58 AM:  + graphql@16.8.1
1:16:58 AM:  + jotai@2.8.0
1:16:58 AM:  + leaflet@1.9.4
1:16:58 AM:  + react@18.3.1
1:16:58 AM:  + react-dom@18.3.1
1:16:58 AM:  + react-error-boundary@4.0.13
1:16:58 AM:  + react-hook-form@7.51.3
1:16:58 AM:  + react-hot-toast@2.4.1
1:16:58 AM:  + react-icons@5.2.0
1:16:58 AM:  + react-leaflet@4.2.1
1:16:58 AM:  + remeda@1.61.0
1:16:58 AM:  + uuid@9.0.1
1:16:58 AM:  + zod@3.23.5
1:16:58 AM:  1102 packages installed [1.93s]
1:16:58 AM: npm packages installed using bun
1:16:58 AM: [0.03ms] ".env.production", ".env"
1:16:58 AM: Successfully installed dependencies
1:16:59 AM: Starting build script
1:17:00 AM: Detected 1 framework(s)
1:17:00 AM: "vite" at version "5.2.10"
1:17:00 AM: Section completed: initializing
1:17:01 AM: ​
1:17:01 AM: Netlify Build                                                 
1:17:01 AM: ────────────────────────────────────────────────────────────────
1:17:01 AM: ​
1:17:01 AM: ❯ Version
1:17:01 AM:   @netlify/build 29.41.1
1:17:01 AM: ​
1:17:01 AM: ❯ Flags
1:17:01 AM:   baseRelDir: true
1:17:01 AM:   buildId: 6632cd466ab1fe0009593fc2
1:17:01 AM:   deployId: 6632cd466ab1fe0009593fc4
1:17:01 AM: ​
1:17:01 AM: ❯ Current directory
1:17:01 AM:   /opt/build/repo
1:17:01 AM: ​
1:17:01 AM: ❯ Config file
1:17:01 AM:   /opt/build/repo/netlify.toml
1:17:01 AM: ​
1:17:01 AM: ❯ Context
1:17:01 AM:   production
1:17:01 AM: ​
1:17:01 AM: build.command from netlify.toml                               
1:17:01 AM: ────────────────────────────────────────────────────────────────
1:17:01 AM: ​
1:17:01 AM: $ bun run build
1:17:01 AM: $ bun spit-graphql-schema && bun generate-all-types && tsc && vite build
1:17:01 AM: $ bin/fetch-schema.sh
1:17:01 AM: HASURA_ADMIN_SECRET: ****
1:17:01 AM: VITE_HASURA_ENDPOINT: ****
1:17:01 AM: node:internal/modules/cjs/loader:1143
1:17:01 AM:   throw err;
1:17:01 AM:   ^
1:17:01 AM: Error: Cannot find module 'core-js/proposals/array-flat-and-flat-map'
1:17:01 AM: Require stack:
1:17:01 AM: - /opt/build/repo/node_modules/apollo-env/lib/polyfills/array.js
1:17:01 AM: - /opt/build/repo/node_modules/apollo-env/lib/polyfills/index.js
1:17:01 AM: - /opt/build/repo/node_modules/apollo-env/lib/index.js
1:17:01 AM: - /opt/build/repo/node_modules/@apollographql/apollo-tools/lib/index.js
1:17:01 AM: - /opt/build/repo/node_modules/apollo-server-core/dist/ApolloServer.js
1:17:01 AM: - /opt/build/repo/node_modules/apollo-server-core/dist/index.js
1:17:01 AM: - /opt/build/repo/node_modules/apollo-server-express/dist/index.js
1:17:01 AM: - /opt/build/repo/node_modules/apollo-server/dist/index.js
1:17:01 AM: - /opt/build/repo/node_modules/graphql-inspector/dist/cli/commands/serve.js
1:17:01 AM: - /opt/build/repo/node_modules/graphql-inspector/dist/cli.js
1:17:01 AM:     at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
1:17:01 AM:     at Module._load (node:internal/modules/cjs/loader:981:27)
1:17:01 AM:     at Module.require (node:internal/modules/cjs/loader:1231:19)
1:17:01 AM:     at require (node:internal/modules/helpers:177:18)
1:17:01 AM:     at Object.<anonymous> (/opt/build/repo/node_modules/apollo-env/lib/polyfills/array.js:3:1)
1:17:01 AM:     at Module._compile (node:internal/modules/cjs/loader:1364:14)
1:17:01 AM:     at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
1:17:01 AM:     at Module.load (node:internal/modules/cjs/loader:1203:32)
1:17:01 AM:     at Module._load (node:internal/modules/cjs/loader:1019:12)
1:17:01 AM:     at Module.require (node:internal/modules/cjs/loader:1231:19) {
1:17:01 AM:   code: 'MODULE_NOT_FOUND',
1:17:01 AM:   requireStack: [
1:17:01 AM:     '/opt/build/repo/node_modules/apollo-env/lib/polyfills/array.js',
1:17:01 AM:     '/opt/build/repo/node_modules/apollo-env/lib/polyfills/index.js',
1:17:01 AM:     '/opt/build/repo/node_modules/apollo-env/lib/index.js',
1:17:01 AM:     '/opt/build/repo/node_modules/@apollographql/apollo-tools/lib/index.js',
1:17:01 AM:     '/opt/build/repo/node_modules/apollo-server-core/dist/ApolloServer.js',
1:17:01 AM:     '/opt/build/repo/node_modules/apollo-server-core/dist/index.js',
1:17:01 AM:     '/opt/build/repo/node_modules/apollo-server-express/dist/index.js',
1:17:01 AM:     '/opt/build/repo/node_modules/apollo-server/dist/index.js',
1:17:01 AM:     '/opt/build/repo/node_modules/graphql-inspector/dist/cli/commands/serve.js',
1:17:01 AM:     '/opt/build/repo/node_modules/graphql-inspector/dist/cli.js'
1:17:01 AM:   ]
1:17:01 AM: }
1:17:01 AM: Node.js v18.20.2
1:17:01 AM: error: "graphql-inspector" exited with code 1
1:17:01 AM: error: script "spit-graphql-schema" exited with code 1
1:17:01 AM: error: script "build" exited with code 1
1:17:01 AM: ​
1:17:01 AM: "build.command" failed                                        
1:17:01 AM: ────────────────────────────────────────────────────────────────
1:17:01 AM: ​
1:17:01 AM:   Error message
1:17:01 AM:   Command failed with exit code 1: bun run build (https://ntl.fyi/exit-code-1)
1:17:01 AM: ​
1:17:01 AM:   Error location
1:17:01 AM:   In build.command from netlify.toml:
1:17:01 AM:   bun run build
1:17:01 AM: ​
1:17:01 AM:   Resolved config
1:17:01 AM:   build:
1:17:01 AM:     command: bun run build
1:17:01 AM:     commandOrigin: config
1:17:01 AM:     environment:
1:17:01 AM:       - HASURA_ADMIN_SECRET
1:17:01 AM:       - VITE_HASURA_ENDPOINT
1:17:01 AM:     publish: /opt/build/repo/dist
1:17:01 AM:     publishOrigin: config
1:17:01 AM:   functionsDirectory: /opt/build/repo/api
1:17:01 AM:   redirects:
1:17:02 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:17:02 AM:     - from: /*
      status: 200
      to: /index.html
  redirectsOrigin: config
1:17:02 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:17:02 AM: Failing build: Failed to build site
1:17:02 AM: Finished processing build request in 26.491s

BTW it also happens for this app: adms-app. Same exact issue

NEVER MIND! I can reproduce locally.