NextJS app build failed

I keep getting “Failed to collect page data for” errors when I attempt to build

10:38:13 PM: Waiting for other deploys from your team to complete. Check the queue: https://app.netlify.com/teams/dvke/builds
10:38:44 PM: build-image version: fcb0c1b3ada6d25c1cb58e8bc514f5f23cc14f15 (focal)
10:38:44 PM: buildbot version: 742cd4f739071a396139ba5020a96a927941b57d
10:38:44 PM: Fetching cached dependencies
10:38:44 PM: Failed to fetch cache, continuing with build
10:38:44 PM: Starting to prepare the repo for build
10:38:44 PM: No cached dependencies found. Cloning fresh repo
10:38:44 PM: git clone --filter=blob:none https://github.com/dvke/issue-tracker
10:38:44 PM: Preparing Git Reference refs/heads/postgres-migration
10:38:45 PM: Starting to install dependencies
10:38:45 PM: Python version set to 3.8
10:38:46 PM: Attempting Ruby version 2.7.2, read from environment
10:38:46 PM: Using Ruby version 2.7.2
10:38:47 PM: Started restoring cached go cache
10:38:47 PM: Finished restoring cached go cache
10:38:48 PM: go version go1.19.13 linux/amd64
10:38:48 PM: Using PHP version 8.0
10:38:49 PM: Downloading and installing node v18.19.1...
10:38:49 PM: Downloading https://nodejs.org/dist/v18.19.1/node-v18.19.1-linux-x64.tar.xz...
10:38:49 PM: Computing checksum with sha256sum
10:38:49 PM: Checksums matched!
10:38:51 PM: Now using node v18.19.1 (npm v10.2.4)
10:38:51 PM: Enabling Node.js Corepack
10:38:52 PM: Started restoring cached build plugins
10:38:52 PM: Finished restoring cached build plugins
10:38:52 PM: Started restoring cached corepack dependencies
10:38:52 PM: Finished restoring cached corepack dependencies
10:38:52 PM: No npm workspaces detected
10:38:52 PM: Started restoring cached node modules
10:38:52 PM: Finished restoring cached node modules
10:38:52 PM: Installing npm packages using npm version 10.2.4
10:39:05 PM: added 619 packages, and audited 620 packages in 13s
10:39:05 PM: 188 packages are looking for funding
10:39:05 PM:   run `npm fund` for details
10:39:05 PM: 2 vulnerabilities (1 low, 1 moderate)
10:39:05 PM: To address all issues, run:
10:39:05 PM:   npm audit fix
10:39:05 PM: Run `npm audit` for details.
10:39:05 PM: npm packages installed
10:39:06 PM: Successfully installed dependencies
10:39:06 PM: Starting build script
10:39:06 PM: Detected 1 framework(s)
10:39:06 PM: "next" at version "13.5.5"
10:39:06 PM: Section completed: initializing
10:39:08 PM: ​
10:39:08 PM: Netlify Build                                                 
10:39:08 PM: ────────────────────────────────────────────────────────────────
10:39:08 PM: ​
10:39:08 PM: ❯ Version
10:39:08 PM:   @netlify/build 29.36.0
10:39:08 PM: ​
10:39:08 PM: ❯ Flags
10:39:08 PM:   baseRelDir: true
10:39:08 PM:   buildId: 65da61c5e43ef4000800d0bb
10:39:08 PM:   deployId: 65da61c5e43ef4000800d0bd
10:39:08 PM: ​
10:39:08 PM: ❯ Current directory
10:39:08 PM:   /opt/build/repo
10:39:08 PM: ​
10:39:08 PM: ❯ Config file
10:39:08 PM:   No config file was defined: using default values.
10:39:08 PM: ​
10:39:08 PM: ❯ Context
10:39:08 PM:   production
10:39:08 PM: ​
10:39:08 PM: ❯ Installing plugins
10:39:08 PM:    - @netlify/plugin-nextjs@4.41.3
10:39:20 PM: ​
10:39:20 PM: ❯ Using Next.js Runtime - v4.41.3
10:39:21 PM: ​
10:39:21 PM: @netlify/plugin-nextjs (onPreBuild event)                     
10:39:21 PM: ────────────────────────────────────────────────────────────────
10:39:21 PM: ​
10:39:21 PM: No Next.js cache to restore.
10:39:21 PM: ​
10:39:21 PM: (@netlify/plugin-nextjs onPreBuild completed in 59ms)
10:39:21 PM: ​
10:39:21 PM: Build command from Netlify app                                
10:39:21 PM: ────────────────────────────────────────────────────────────────
10:39:21 PM: ​
10:39:21 PM: $ npm run build
10:39:21 PM: > issue-tracker@0.1.0 build
10:39:21 PM: > next build
10:39:22 PM: ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
10:39:22 PM:    Creating an optimized production build ...
10:39:46 PM: (node:5904) [DEP_WEBPACK_MODULE_UPDATE_HASH] DeprecationWarning: Module.updateHash: Use new ChunkGraph API
10:39:46 PM: (Use `node --trace-deprecation ...` to show where the warning was created)
10:39:55 PM:  ✓ Compiled successfully
10:39:55 PM:    Linting and checking validity of types ...
10:39:58 PM:    Collecting page data ...
10:40:00 PM: Prisma has detected that this project was built on Netlify CI, which caches dependencies. This leads to an outdated Prisma Client because Prisma"s auto-generation isn"t triggered. To fix this, make sure to run the `prisma generate` command during the build process.
10:40:00 PM: Learn how: https://pris.ly/d/netlify-build
10:40:00 PM: PrismaClientInitializationError: Prisma has detected that this project was built on Netlify CI, which caches dependencies. This leads to an outdated Prisma Client because Prisma"s auto-generation isn"t triggered. To fix this, make sure to run the `prisma generate` command during the build process.
10:40:00 PM: Learn how: https://pris.ly/d/netlify-build
10:40:00 PM:     at rl (/opt/build/repo/node_modules/@prisma/client/runtime/library.js:36:69)
10:40:00 PM:     at new t (/opt/build/repo/node_modules/@prisma/client/runtime/library.js:131:2670)
10:40:00 PM:     at 1468 (/opt/build/repo/.next/server/app/api/users/route.js:1:2113)
10:40:00 PM:     at __webpack_require__ (/opt/build/repo/.next/server/webpack-runtime.js:1:161)
10:40:00 PM:     at 41195 (/opt/build/repo/.next/server/app/api/users/route.js:1:727)
10:40:00 PM:     at __webpack_require__ (/opt/build/repo/.next/server/webpack-runtime.js:1:161)
10:40:00 PM:     at __webpack_exec__ (/opt/build/repo/.next/server/app/api/users/route.js:1:2214)
10:40:00 PM:     at /opt/build/repo/.next/server/app/api/users/route.js:1:2261
10:40:00 PM:     at __webpack_require__.X (/opt/build/repo/.next/server/webpack-runtime.js:1:1759)
10:40:00 PM:     at /opt/build/repo/.next/server/app/api/users/route.js:1:2227 {
10:40:00 PM:   clientVersion: "5.9.1",
10:40:00 PM:   errorCode: undefined
10:40:00 PM: }
10:40:00 PM: > Build error occurred
10:40:00 PM: Error: Failed to collect page data for /api/users
10:40:00 PM:     at /opt/build/repo/node_modules/next/dist/build/utils.js:1171:15
10:40:00 PM:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
10:40:00 PM:   type: "Error"
10:40:00 PM: }
10:40:01 PM: ​
10:40:01 PM: "build.command" failed                                        
10:40:01 PM: ────────────────────────────────────────────────────────────────
10:40:01 PM: ​
10:40:01 PM:   Error message
10:40:01 PM:   Command failed with exit code 1: npm run build
10:40:01 PM: ​
10:40:01 PM:   Error location
10:40:01 PM:   In Build command from Netlify app:
10:40:01 PM:   npm run build
10:40:01 PM: ​
10:40:01 PM:   Resolved config
10:40:01 PM:   build:
10:40:01 PM:     command: npm run build
10:40:01 PM:     commandOrigin: ui
10:40:01 PM:     environment:
10:40:01 PM:       - NEXT_PRIVATE_TARGET
10:40:01 PM:     publish: /opt/build/repo/.next
10:40:01 PM:     publishOrigin: ui
10:40:01 PM:   plugins:
10:40:01 PM:     - inputs: {}
10:40:01 PM:       origin: ui
10:40:01 PM:       package: "@netlify/plugin-nextjs"
10:40:01 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:40:01 PM: Failing build: Failed to build site
10:40:01 PM: Finished processing build request in 1m17.653s
10:40:01 PM: Failed during stage "building site": Build script returned non-zero exit code: 2

@dvke It may not be the only issue, but there are some pretty clear notes in there:

10:40:00 PM: Prisma has detected that this project was built on Netlify CI, which caches dependencies. This leads to an outdated Prisma Client because Prisma"s auto-generation isn"t triggered. To fix this, make sure to run the `prisma generate` command during the build process.
10:40:00 PM: Learn how: https://pris.ly/d/netlify-build
10:40:00 PM: PrismaClientInitializationError: Prisma has detected that this project was built on Netlify CI, which caches dependencies. This leads to an outdated Prisma Client because Prisma"s auto-generation isn"t triggered. To fix this, make sure to run the `prisma generate` command during the build process.
10:40:00 PM: Learn how: https://pris.ly/d/netlify-build

Have you visited https://pris.ly/d/netlify-build?