Next.js 14 w/ v5 runtime fails to deploy with 404s

I’m testing the v5 runtime, and while the build appears to succeed and npx netlify-cli dev works fine, the tests and deploy fail and result in 404s.

The code for the deployment can be found here: https://github.com/brndnmtthws/conky/tree/web-deps/web

The build log is as shown below:

10:56:45 AM: build-image version: fcb0c1b3ada6d25c1cb58e8bc514f5f23cc14f15 (focal)
10:56:45 AM: buildbot version: ee2ef905a4bdb64f7733dd60a718aa00319e6f82
10:56:46 AM: Fetching cached dependencies
10:56:46 AM: Failed to fetch cache, continuing with build
10:56:46 AM: Starting to prepare the repo for build
10:56:46 AM: No cached dependencies found. Cloning fresh repo
10:56:46 AM: git clone --filter=blob:none https://github.com/brndnmtthws/conky
10:56:46 AM: Preparing Git Reference pull/1810/head
10:56:47 AM: Custom publish path detected. Proceeding with the specified path: 'web/.next'
10:56:47 AM: Custom build command detected. Proceeding with the specified command: 'npm run build'
10:56:47 AM: Custom ignore command detected. Proceeding with the specified command: 'git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../doc/'
10:56:49 AM: manpath: warning: $PATH not set
10:56:50 AM: Starting to install dependencies
10:56:53 AM: Python version set to 3.8
10:56:53 AM: Attempting Ruby version 2.7.2, read from environment
10:56:54 AM: Using Ruby version 2.7.2
10:56:54 AM: Started restoring cached go cache
10:56:54 AM: Finished restoring cached go cache
10:56:54 AM: Installing Go version 1.17 (requested 1.17)
10:56:59 AM: go version go1.17 linux/amd64
10:57:00 AM: Using PHP version 8.0
10:57:01 AM: Downloading and installing node v20.12.1...
10:57:02 AM: Downloading https://nodejs.org/dist/v20.12.1/node-v20.12.1-linux-x64.tar.xz...
10:57:02 AM: Computing checksum with sha256sum
10:57:02 AM: Checksums matched!
10:57:04 AM: Now using node v20.12.1 (npm v10.5.0)
10:57:04 AM: Enabling Node.js Corepack
10:57:04 AM: Started restoring cached build plugins
10:57:04 AM: Finished restoring cached build plugins
10:57:04 AM: Started restoring cached corepack dependencies
10:57:04 AM: Finished restoring cached corepack dependencies
10:57:04 AM: No npm workspaces detected
10:57:04 AM: Started restoring cached node modules
10:57:04 AM: Finished restoring cached node modules
10:57:05 AM: Installing npm packages using npm version 10.5.0
10:57:13 AM: npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
10:57:15 AM: npm WARN deprecated puppeteer@18.1.0: < 19.4.0 is no longer supported
10:57:31 AM: added 1170 packages, and audited 1171 packages in 26s
10:57:31 AM: 323 packages are looking for funding
10:57:31 AM:   run `npm fund` for details
10:57:31 AM: 7 vulnerabilities (1 low, 2 moderate, 4 high)
10:57:31 AM: To address issues that do not require attention, run:
10:57:31 AM:   npm audit fix
10:57:31 AM: Some issues need review, and may require choosing
10:57:31 AM: a different dependency.
10:57:31 AM: Run `npm audit` for details.
10:57:31 AM: npm packages installed
10:57:32 AM: Successfully installed dependencies
10:57:32 AM: Starting build script
10:57:35 AM: Detected 1 framework(s)
10:57:35 AM: "next" at version "14.1.4"
10:57:35 AM: Section completed: initializing
10:57:36 AM: ​
10:57:36 AM: Netlify Build                                                 
10:57:36 AM: ────────────────────────────────────────────────────────────────
10:57:36 AM: ​
10:57:36 AM: ❯ Version
10:57:36 AM:   @netlify/build 29.39.1
10:57:36 AM: ​
10:57:36 AM: ❯ Flags
10:57:36 AM:   baseRelDir: true
10:57:36 AM:   buildId: 6616a89f79bfef0008e5f927
10:57:36 AM:   deployId: 6616a89f79bfef0008e5f929
10:57:36 AM: ​
10:57:36 AM: ❯ Current directory
10:57:36 AM:   /opt/build/repo/web
10:57:36 AM: ​
10:57:36 AM: ❯ Config file
10:57:36 AM:   /opt/build/repo/web/netlify.toml
10:57:36 AM: ​
10:57:36 AM: ❯ Context
10:57:36 AM:   deploy-preview
10:57:36 AM: ​
10:57:36 AM: ❯ Using Next.js Runtime - v5.0.0
10:57:36 AM: ​
10:57:36 AM: ❯ Loading plugins
10:57:36 AM:    - netlify-plugin-cypress@2.2.1 from netlify.toml and package.json
10:57:38 AM: ​
10:57:38 AM: @netlify/plugin-nextjs (onPreBuild event)                     
10:57:38 AM: ────────────────────────────────────────────────────────────────
10:57:38 AM: ​
10:57:38 AM: No Next.js cache to restore
10:57:38 AM: ​
10:57:38 AM: (@netlify/plugin-nextjs onPreBuild completed in 10ms)
10:57:38 AM: ​
10:57:38 AM: netlify-plugin-cypress (onPreBuild event)                     
10:57:38 AM: ────────────────────────────────────────────────────────────────
10:57:38 AM: ​
10:57:38 AM: [STARTED] Task without title.
10:57:40 AM: [SUCCESS] Task without title.
10:57:40 AM: DevTools listening on ws://127.0.0.1:45565/devtools/browser/48fdf12a-2355-409d-bc0c-830ddc3b0f05
10:57:41 AM: Displaying Cypress info...
10:57:41 AM: Detected no known browsers installed
10:57:41 AM: Proxy Settings: none detected
10:57:41 AM: Environment Variables:
10:57:41 AM: CYPRESS_CACHE_FOLDER: ./node_modules/CypressBinary
10:57:41 AM: Application Data: /opt/buildhome/.config/cypress/cy/development
10:57:41 AM: Browser Profiles: /opt/buildhome/.config/cypress/cy/development/browsers
10:57:41 AM: Binary Caches: /opt/build/repo/web/node_modules/CypressBinary
10:57:41 AM: Cypress Version: 13.7.2 (stable)
10:57:41 AM: System Platform: linux (Ubuntu - 20.04)
10:57:41 AM: System Memory: 66.3 GB free 55.4 GB
10:57:41 AM: ​
10:57:41 AM: (netlify-plugin-cypress onPreBuild completed in 3s)
10:57:41 AM: ​
10:57:41 AM: build.command from netlify.toml                               
10:57:41 AM: ────────────────────────────────────────────────────────────────
10:57:41 AM: ​
10:57:41 AM: $ npm run build
10:57:41 AM: > build
10:57:41 AM: > npm run write-search-index && next build
10:57:41 AM: > write-search-index
10:57:41 AM: > tsx ./scripts/write-search-index.ts
10:57:43 AM: ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
10:57:43 AM:    ▲ Next.js 14.1.4
10:57:43 AM:    Linting and checking validity of types ...
10:57:45 AM:    Creating an optimized production build ...
10:57:53 AM:  ✓ Compiled successfully
10:57:53 AM:    Collecting page data ...
10:57:54 AM:    Generating static pages (0/11) ...
10:57:55 AM:    Generating static pages (2/11)
10:57:55 AM:    Generating static pages (5/11)
10:57:56 AM:    Generating static pages (8/11)
10:57:56 AM:  ✓ Generating static pages (11/11)
10:57:57 AM:    Finalizing page optimization ...
10:57:57 AM:    Collecting build traces ...
10:58:07 AM: Route (pages)                                  Size     First Load JS
10:58:07 AM: ┌ ● / (778 ms)                                 1.23 kB         114 kB
10:58:07 AM: ├   /_app                                      0 B            78.2 kB
10:58:07 AM: ├ ○ /404 (475 ms)                              4.77 kB         118 kB
10:58:07 AM: ├ ● /config_settings (915 ms)                  1.59 kB         114 kB
10:58:07 AM: ├ ● /documents/[slug] (4023 ms)                68.6 kB         181 kB
10:58:07 AM: ├   ├ /documents/docker (909 ms)
10:58:07 AM: ├   ├ /documents/syntax-highlighting (818 ms)
10:58:07 AM: ├   ├ /documents/about (799 ms)
10:58:07 AM: ├   ├ /documents/contributing (785 ms)
10:58:07 AM: ├   └ /documents/compiling (712 ms)
10:58:07 AM: ├ ● /lua (791 ms)                              1.58 kB         114 kB
10:58:07 AM: └ ● /variables (1064 ms)                       1.58 kB         114 kB
10:58:07 AM: + First Load JS shared by all                  84.8 kB
10:58:07 AM:   ├ chunks/framework-5429a50ba5373c56.js       45.2 kB
10:58:07 AM:   ├ chunks/main-d2ba44903cd47711.js            31.7 kB
10:58:07 AM:   └ other shared chunks (total)                7.89 kB
10:58:07 AM: ○  (Static)  prerendered as static content
10:58:07 AM: ●  (SSG)     prerendered as static HTML (uses getStaticProps)
10:58:07 AM: ​
10:58:07 AM: (build.command completed in 26s)
10:58:07 AM: ​
10:58:07 AM: @netlify/plugin-nextjs (onBuild event)                        
10:58:07 AM: ────────────────────────────────────────────────────────────────
10:58:07 AM: ​
10:58:07 AM: Next.js cache saved
10:58:07 AM: ​
10:58:07 AM: (@netlify/plugin-nextjs onBuild completed in 794ms)
10:58:07 AM: ​
10:58:07 AM: Functions bundling                                            
10:58:07 AM: ────────────────────────────────────────────────────────────────
10:58:07 AM: ​
10:58:07 AM: Packaging Functions from .netlify/functions-internal directory:
10:58:07 AM:  - ___netlify-server-handler/___netlify-server-handler.mjs
10:58:07 AM: ​
10:58:09 AM: ​
10:58:09 AM: (Functions bundling completed in 1.3s)
10:58:09 AM: ​
10:58:09 AM: Edge Functions bundling                                       
10:58:09 AM: ────────────────────────────────────────────────────────────────
10:58:09 AM: ​
10:58:10 AM: ​
10:58:10 AM: (Edge Functions bundling completed in 908ms)
10:58:10 AM: ​
10:58:10 AM: @netlify/plugin-nextjs (onPostBuild event)                    
10:58:10 AM: ────────────────────────────────────────────────────────────────
10:58:10 AM: ​
10:58:10 AM: ​
10:58:10 AM: (@netlify/plugin-nextjs onPostBuild completed in 4ms)
10:58:10 AM: ​
10:58:10 AM: netlify-plugin-cypress (onPostBuild event)                    
10:58:10 AM: ────────────────────────────────────────────────────────────────
10:58:10 AM: ​
10:58:11 AM: DevTools listening on ws://127.0.0.1:43791/devtools/browser/286fcefb-c7cb-4ae4-823c-6558e6b1de2f
10:58:11 AM: Missing baseUrl in compilerOptions. tsconfig-paths will be skipped
10:58:12 AM: ====================================================================================================
10:58:12 AM:   (Run Starting)
10:58:12 AM:   ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
10:58:12 AM:   │ Cypress:        13.7.2                                                                         │
10:58:12 AM:   │ Browser:        Custom Chromium 107 (headless)                                                 │
10:58:12 AM:   │ Node Version:   v20.12.1 (/opt/buildhome/.nvm/versions/node/v20.12.1/bin/node)                 │
10:58:12 AM:   │ Specs:          1 found (basic.cy.js)                                                          │
10:58:12 AM:   │ Searched:       cypress/e2e/**/*.cy.{js,jsx,ts,tsx}                                            │
10:58:12 AM:   └────────────────────────────────────────────────────────────────────────────────────────────────┘
10:58:12 AM: ────────────────────────────────────────────────────────────────────────────────────────────────────
10:58:12 AM:   Running:  basic.cy.js                                                                     (1 of 1)
10:58:14 AM: 
10:58:14 AM:   check index renders
10:58:19 AM:     1) displays the title text
10:58:19 AM:   check config settings
10:58:19 AM:     2) "before each" hook for "displays the title text"
10:58:19 AM:   check variables
10:58:19 AM:     3) "before each" hook for "displays the title text"
10:58:19 AM:   check lua
10:58:19 AM:     4) "before each" hook for "displays the title text"
10:58:19 AM:   0 passing (5s)
10:58:19 AM:   4 failing
10:58:19 AM:   1) check index renders
10:58:19 AM:        displays the title text:
10:58:19 AM:      AssertionError: Timed out retrying after 4000ms: Expected to find element: `[data-cy="top-link"]`, but never found it.
10:58:19 AM:       at Context.eval (webpack://conky-website/./cypress/e2e/basic.cy.js:7:7)
10:58:19 AM: 
10:58:19 AM:   2) check config settings
10:58:19 AM:        "before each" hook for "displays the title text":
10:58:19 AM:      CypressError: `cy.visit()` failed trying to load:
10:58:19 AM: http://localhost:8080/config_settings
10:58:19 AM: The response we received from your web server was:
10:58:19 AM:   > 404: Not Found
10:58:19 AM: This was considered a failure because the status code was not `2xx`.
10:58:19 AM: If you do not want status codes to cause failures pass the option: `failOnStatusCode: false`
10:58:19 AM: Because this error occurred during a `before each` hook we are skipping the remaining tests in the current suite: `check config settings`
10:58:19 AM:       at <unknown> (http://localhost:8080/__cypress/runner/cypress_runner.js:131049:76)
10:58:19 AM:       at visitFailedByErr (http://localhost:8080/__cypress/runner/cypress_runner.js:130463:12)
10:58:19 AM:       at <unknown> (http://localhost:8080/__cypress/runner/cypress_runner.js:131032:13)
10:58:19 AM:       at tryCatcher (http://localhost:8080/__cypress/runner/cypress_runner.js:1807:23)
10:58:19 AM:       at Promise._settlePromiseFromHandler (http://localhost:8080/__cypress/runner/cypress_runner.js:1519:31)
10:58:19 AM:       at Promise._settlePromise (http://localhost:8080/__cypress/runner/cypress_runner.js:1576:18)
10:58:19 AM:       at Promise._settlePromise0 (http://localhost:8080/__cypress/runner/cypress_runner.js:1621:10)
10:58:19 AM:       at Promise._settlePromises (http://localhost:8080/__cypress/runner/cypress_runner.js:1697:18)
10:58:19 AM:       at _drainQueueStep (http://localhost:8080/__cypress/runner/cypress_runner.js:2407:12)
10:58:19 AM:       at _drainQueue (http://localhost:8080/__cypress/runner/cypress_runner.js:2400:9)
10:58:19 AM:       at Async._drainQueues (http://localhost:8080/__cypress/runner/cypress_runner.js:2416:5)
10:58:19 AM:       at Async.drainQueues (http://localhost:8080/__cypress/runner/cypress_runner.js:2286:14)
10:58:19 AM:   From Your Spec Code:
10:58:19 AM:       at Context.eval (webpack://conky-website/./cypress/e2e/basic.cy.js:12:7)
10:58:19 AM: 
10:58:19 AM:   3) check variables
10:58:19 AM:        "before each" hook for "displays the title text":
10:58:19 AM:      CypressError: `cy.visit()` failed trying to load:
10:58:19 AM: http://localhost:8080/variables
10:58:19 AM: The response we received from your web server was:
10:58:19 AM:   > 404: Not Found
10:58:19 AM: This was considered a failure because the status code was not `2xx`.
10:58:19 AM: If you do not want status codes to cause failures pass the option: `failOnStatusCode: false`
10:58:19 AM: Because this error occurred during a `before each` hook we are skipping the remaining tests in the current suite: `check variables`
10:58:19 AM:       at <unknown> (http://localhost:8080/__cypress/runner/cypress_runner.js:131049:76)
10:58:19 AM:       at visitFailedByErr (http://localhost:8080/__cypress/runner/cypress_runner.js:130463:12)
10:58:19 AM:       at <unknown> (http://localhost:8080/__cypress/runner/cypress_runner.js:131032:13)
10:58:19 AM:       at tryCatcher (http://localhost:8080/__cypress/runner/cypress_runner.js:1807:23)
10:58:19 AM:       at Promise._settlePromiseFromHandler (http://localhost:8080/__cypress/runner/cypress_runner.js:1519:31)
10:58:19 AM:       at Promise._settlePromise (http://localhost:8080/__cypress/runner/cypress_runner.js:1576:18)
10:58:19 AM:       at Promise._settlePromise0 (http://localhost:8080/__cypress/runner/cypress_runner.js:1621:10)
10:58:19 AM:       at Promise._settlePromises (http://localhost:8080/__cypress/runner/cypress_runner.js:1697:18)
10:58:19 AM:       at _drainQueueStep (http://localhost:8080/__cypress/runner/cypress_runner.js:2407:12)
10:58:19 AM:       at _drainQueue (http://localhost:8080/__cypress/runner/cypress_runner.js:2400:9)
10:58:19 AM:       at Async._drainQueues (http://localhost:8080/__cypress/runner/cypress_runner.js:2416:5)
10:58:19 AM:       at Async.drainQueues (http://localhost:8080/__cypress/runner/cypress_runner.js:2286:14)
10:58:19 AM:   From Your Spec Code:
10:58:19 AM:       at Context.eval (webpack://conky-website/./cypress/e2e/basic.cy.js:22:7)
10:58:19 AM: 
10:58:19 AM:   4) check lua
10:58:19 AM:        "before each" hook for "displays the title text":
10:58:19 AM:      CypressError: `cy.visit()` failed trying to load:
10:58:19 AM: http://localhost:8080/lua
10:58:19 AM: The response we received from your web server was:
10:58:19 AM:   > 404: Not Found
10:58:19 AM: This was considered a failure because the status code was not `2xx`.
10:58:19 AM: If you do not want status codes to cause failures pass the option: `failOnStatusCode: false`
10:58:19 AM: Because this error occurred during a `before each` hook we are skipping the remaining tests in the current suite: `check lua`
10:58:19 AM:       at <unknown> (http://localhost:8080/__cypress/runner/cypress_runner.js:131049:76)
10:58:19 AM:       at visitFailedByErr (http://localhost:8080/__cypress/runner/cypress_runner.js:130463:12)
10:58:19 AM:       at <unknown> (http://localhost:8080/__cypress/runner/cypress_runner.js:131032:13)
10:58:19 AM:       at tryCatcher (http://localhost:8080/__cypress/runner/cypress_runner.js:1807:23)
10:58:19 AM:       at Promise._settlePromiseFromHandler (http://localhost:8080/__cypress/runner/cypress_runner.js:1519:31)
10:58:19 AM:       at Promise._settlePromise (http://localhost:8080/__cypress/runner/cypress_runner.js:1576:18)
10:58:19 AM:       at Promise._settlePromise0 (http://localhost:8080/__cypress/runner/cypress_runner.js:1621:10)
10:58:19 AM:       at Promise._settlePromises (http://localhost:8080/__cypress/runner/cypress_runner.js:1697:18)
10:58:19 AM:       at _drainQueueStep (http://localhost:8080/__cypress/runner/cypress_runner.js:2407:12)
10:58:19 AM:       at _drainQueue (http://localhost:8080/__cypress/runner/cypress_runner.js:2400:9)
10:58:19 AM:       at Async._drainQueues (http://localhost:8080/__cypress/runner/cypress_runner.js:2416:5)
10:58:19 AM:       at Async.drainQueues (http://localhost:8080/__cypress/runner/cypress_runner.js:2286:14)
10:58:19 AM:   From Your Spec Code:
10:58:19 AM:       at Context.eval (webpack://conky-website/./cypress/e2e/basic.cy.js:36:7)
10:58:19 AM: 
10:58:19 AM:   (Results)
10:58:19 AM:   ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
10:58:19 AM:   │ Tests:        5                                                                                │
10:58:19 AM:   │ Passing:      0                                                                                │
10:58:19 AM:   │ Failing:      4                                                                                │
10:58:19 AM:   │ Pending:      0                                                                                │
10:58:19 AM:   │ Skipped:      1                                                                                │
10:58:19 AM:   │ Screenshots:  4                                                                                │
10:58:19 AM:   │ Video:        false                                                                            │
10:58:19 AM:   │ Duration:     4 seconds                                                                        │
10:58:19 AM:   │ Spec Ran:     basic.cy.js                                                                      │
10:58:19 AM:   └────────────────────────────────────────────────────────────────────────────────────────────────┘
10:58:19 AM:   (Screenshots)
10:58:19 AM:   -  /opt/build/repo/web/cypress/screenshots/basic.cy.js/check index renders -- displ     (1280x720)
10:58:19 AM:      ays the title text (failed).png
10:58:19 AM:   -  /opt/build/repo/web/cypress/screenshots/basic.cy.js/check config settings -- dis     (1280x720)
10:58:19 AM:      plays the title text -- before each hook (failed).png
10:58:19 AM:   -  /opt/build/repo/web/cypress/screenshots/basic.cy.js/check variables -- displays      (1280x720)
10:58:19 AM:      the title text -- before each hook (failed).png
10:58:19 AM:   -  /opt/build/repo/web/cypress/screenshots/basic.cy.js/check lua -- displays the ti     (1280x720)
10:58:19 AM:      tle text -- before each hook (failed).png
10:58:19 AM: ====================================================================================================
10:58:19 AM:   (Run Finished)
10:58:19 AM:        Spec                                              Tests  Passing  Failing  Pending  Skipped  
10:58:19 AM:   ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
10:58:19 AM:   │ ✖  basic.cy.js                              00:04        5        -        4        -        1 │
10:58:19 AM:   └────────────────────────────────────────────────────────────────────────────────────────────────┘
10:58:19 AM:     ✖  1 of 1 failed (100%)                     00:04        5        -        4        -        1  
10:58:19 AM: ​
10:58:19 AM: @netlify/plugin-nextjs (onEnd event)                          
10:58:19 AM: ────────────────────────────────────────────────────────────────
10:58:19 AM: ​
10:58:19 AM: ​
10:58:19 AM: (@netlify/plugin-nextjs onEnd completed in 5ms)
10:58:19 AM: ​
10:58:19 AM: Plugin "netlify-plugin-cypress" failed                        
10:58:19 AM: ────────────────────────────────────────────────────────────────
10:58:19 AM: ​
10:58:19 AM:   Error message
10:58:19 AM:   Error: Failed Cypress tests
10:58:19 AM:   4 test(s) failed
10:58:19 AM: ​
10:58:19 AM:   Plugin details
10:58:19 AM:   Package:        netlify-plugin-cypress
10:58:19 AM:   Version:        2.2.1
10:58:19 AM:   Repository:     git+https://github.com/cypress-io/netlify-plugin-cypress.git
10:58:19 AM:   npm link:       https://www.npmjs.com/package/netlify-plugin-cypress
10:58:19 AM:   Report issues:  https://github.com/cypress-io/netlify-plugin-cypress/issues
10:58:19 AM: ​
10:58:19 AM:   Error location
10:58:19 AM:   In "onPostBuild" event in "netlify-plugin-cypress" from netlify.toml and package.json
10:58:19 AM: ​
10:58:19 AM:   Resolved config
10:58:19 AM:   build:
10:58:19 AM:     base: /opt/build/repo/web
10:58:19 AM:     command: npm run build
10:58:19 AM:     commandOrigin: config
10:58:19 AM:     environment:
10:58:19 AM:       - REVIEW_ID
10:58:19 AM:       - CYPRESS_CACHE_FOLDER
10:58:19 AM:       - TERM
10:58:19 AM:     ignore: git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../doc/
10:58:19 AM:     publish: /opt/build/repo/web/.next
10:58:19 AM:     publishOrigin: config
10:58:19 AM:   plugins:
10:58:19 AM:     - inputs: {}
10:58:19 AM:       origin: config
10:58:19 AM:       package: '@netlify/plugin-nextjs'
10:58:19 AM:     - inputs:
10:58:19 AM:         enable: false
10:58:19 AM:       origin: config
10:58:19 AM:       package: netlify-plugin-cypress
10:58:19 AM:   redirects:
10:58:19 AM:     - from: /_next/image
10:58:19 AM:       query:
10:58:19 AM:         q: ':quality'
10:58:19 AM:         url: ':url'
10:58:19 AM:         w: ':width'
10:58:19 AM:       status: 200
10:58:19 AM:       to: /.netlify/images?url=:url&w=:width&q=:quality
10:58:20 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
10:58:20 AM:     - from: /_ipx/*
      query:
        q: ':quality'
        url: ':url'
        w: ':width'
      status: 200
      to: /.netlify/images?url=:url&w=:width&q=:quality
  redirectsOrigin: inline
10:58:20 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:58:20 AM: Failing build: Failed to build site
10:58:20 AM: Finished processing build request in 1m34.761s

This is expected. The Next.js Runtime deletes your Next.js-generated HTML files and uploads them to Netlify Blobs. So your Cypress tests can’t access those files anymore. I’d recommend testing the deploy once it’s done for more accurate results. Testing durign the build would probably not achieve much as the site is served in a completely different environment than builds.

I see. Is there any documentation on how to use tests as part of the build with v5? It’s not clear to me what the solution is to make sure that deploys don’t deploy until after the tests have passed.

After futzing around for a while, I got it working based on the instructions here.

Here’s the final result if anyone else bumps into this when upgrading to v5 with cypress tests: conky/web/netlify.toml at d45836f14e389f136a1340cc7bceff5ee94c07dd · brndnmtthws/conky · GitHub

The gist is that you need to switch from post-build to pre-build testing.