I opened a new PR to our dev environment today and the build quickly failed with an “Internal plugin error”. Looking at the log, I see that there is a new version of @netlify/plugin-nextjs
and there is a ticket in that plugin’s Github repo that is very similar to ours. I added details of what we’re encountering there: Build Error - Plugin "@netlify/plugin-nextjs" internal error · Issue #2024 · opennextjs/opennextjs-netlify · GitHub, but the full log is:
4:24:16 PM: build-image version: 6c82004ef0368b3a0232c6837cead23188bb347e (focal) 4:24:16 PM: buildbot version: 47d1e6bf5eecb8879b17d173eab0e8dc3ea1b589 4:24:16 PM: Building without cache 4:24:16 PM: Starting to prepare the repo for build 4:24:17 PM: No cached dependencies found. Cloning fresh repo 4:24:17 PM: git clone --filter=blob:none https://github.com/OfficialMetrie/metrie.com 4:24:17 PM: Preparing Git Reference refs/heads/dev 4:24:20 PM: Parsing package.json dependencies 4:24:21 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'site/.next' versus '.next' in the Netlify UI 4:24:21 PM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'site/netlify/functions' versus 'netlify/functions' in the Netlify UI 4:24:22 PM: Starting to install dependencies 4:24:22 PM: Attempting Node.js version 'v16.13.2' from .nvmrc 4:24:22 PM: Downloading and installing node v16.13.2... 4:24:22 PM: Downloading https://nodejs.org/dist/v16.13.2/node-v16.13.2-linux-x64.tar.xz... 4:24:23 PM: Computing checksum with sha256sum 4:24:23 PM: Checksums matched! 4:24:25 PM: Now using node v16.13.2 (npm v8.1.2) 4:24:25 PM: Enabling Node.js Corepack 4:24:25 PM: Started restoring cached build plugins 4:24:25 PM: Finished restoring cached build plugins 4:24:25 PM: Started restoring cached corepack dependencies 4:24:25 PM: Finished restoring cached corepack dependencies 4:24:25 PM: No npm workspaces detected 4:24:25 PM: Started restoring cached node modules 4:24:25 PM: Finished restoring cached node modules 4:24:25 PM: Installing npm packages using npm version 8.1.2 4:24:27 PM: added 2484 packages in 2s 4:24:27 PM: 303 packages are looking for funding 4:24:27 PM: run `npm fund` for details 4:24:27 PM: npm packages installed 4:24:27 PM: Python version set to 3.8 4:24:27 PM: Using PHP version 8.0 4:24:28 PM: Attempting Ruby version 2.7.2, read from environment 4:24:28 PM: Using Ruby version 2.7.2 4:24:29 PM: Started restoring cached go cache 4:24:29 PM: Finished restoring cached go cache 4:24:29 PM: Installing Go version 1.19.5 (requested 1.19.5) 4:24:34 PM: go version go1.19.5 linux/amd64 4:24:35 PM: Install dependencies script success 4:24:35 PM: Starting build script 4:24:35 PM: Using stage install dependencies 4:24:35 PM: Detected 1 framework(s) 4:24:35 PM: "next" at version "unknown" 4:24:35 PM: Section completed: initializing 4:24:37 PM: 4:24:37 PM: Netlify Build 4:24:37 PM: ──────────────────────────────────────────────────────────────── 4:24:37 PM: 4:24:37 PM: ❯ Version 4:24:37 PM: @netlify/build 29.9.0 4:24:37 PM: 4:24:37 PM: ❯ Flags 4:24:37 PM: baseRelDir: true 4:24:37 PM: buildId: 642b35e66b64da760f6f7791 4:24:37 PM: deployId: 642b35e66b64da760f6f7793 4:24:37 PM: 4:24:37 PM: ❯ Current directory 4:24:37 PM: /opt/build/repo/site 4:24:37 PM: 4:24:37 PM: ❯ Config file 4:24:37 PM: No config file was defined: using default values. 4:24:37 PM: 4:24:37 PM: ❯ Context 4:24:37 PM: production 4:24:37 PM: 4:24:37 PM: ❯ Installing plugins 4:24:37 PM: - @netlify/plugin-nextjs@4.33.0 4:24:46 PM: 4:24:46 PM: ❯ Using Next.js Runtime - v4.33.0 4:24:47 PM: 4:24:47 PM: Plugin "@netlify/plugin-nextjs" internal error 4:24:47 PM: ──────────────────────────────────────────────────────────────── 4:24:47 PM: 4:24:47 PM: Error message 4:24:47 PM: Could not import plugin: 4:24:47 PM: Error: Could not find Next.js server 4:24:47 PM: 4:24:47 PM: Plugin details 4:24:47 PM: Package: @netlify/plugin-nextjs 4:24:47 PM: Version: 4.33.0 4:24:47 PM: Repository: git+https://github.com/netlify/next-runtime.git 4:24:47 PM: npm link: https://www.npmjs.com/package/@netlify/plugin-nextjs 4:24:47 PM: Report issues: https://github.com/netlify/next-runtime/issues 4:24:47 PM: 4:24:47 PM: Error location 4:24:47 PM: While loading "@netlify/plugin-nextjs" from Netlify app 4:24:47 PM: at getNextServer (/opt/build/repo/site/.netlify/plugins/node_modules/@netlify/plugin-nextjs/lib/templates/handlerUtils.js:169:19) 4:24:47 PM: at Object.<anonymous> (/opt/build/repo/site/.netlify/plugins/node_modules/@netlify/plugin-nextjs/lib/templates/server.js:5:53) 4:24:47 PM: at Module._compile (node:internal/modules/cjs/loader:1196:14) 4:24:47 PM: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10) 4:24:47 PM: at Module.load (node:internal/modules/cjs/loader:1074:32) 4:24:47 PM: at Function.Module._load (node:internal/modules/cjs/loader:909:12) 4:24:47 PM: at Module.require (node:internal/modules/cjs/loader:1098:19) 4:24:47 PM: at require (node:internal/modules/cjs/helpers:108:18) 4:24:47 PM: at Object.<anonymous> (/opt/build/repo/site/.netlify/plugins/node_modules/@netlify/plugin-nextjs/lib/templates/getHandler.js:14:31) 4:24:47 PM: at Module._compile (node:internal/modules/cjs/loader:1196:14) 4:24:47 PM: 4:24:47 PM: Resolved config 4:24:47 PM: build: 4:24:47 PM: base: /opt/build/repo/site 4:24:47 PM: command: NODE_OPTIONS=--max_old_space_size=4096 npm ci && npm run build 4:24:47 PM: commandOrigin: ui 4:24:48 PM: Failed during stage 'building site': Build script returned non-zero exit code: 3 (https://ntl.fyi/exit-code-3) 4:24:47 PM: environment: 4:24:47 PM: - ALGOLIA_API_KEY 4:24:47 PM: - ALGOLIA_APP_ID 4:24:47 PM: - API_BASE 4:24:47 PM: - API_PREVIEW_TOKEN 4:24:47 PM: - BLOG_ARTICLES_INDEX_ID 4:24:47 PM: - CATALOGS_INDEX_ID 4:24:47 PM: - CONTENTFUL_ACCESS_TOKEN 4:24:47 PM: - CONTENTFUL_ALGOLIA_UPDATE_KEY 4:24:47 PM: - CONTENTFUL_ENVIRONMENT 4:24:47 PM: - CONTENTFUL_MANAGEMENT_ACCESS_TOKEN 4:24:47 PM: - CONTENTFUL_PREVIEW_ACCESS_TOKEN 4:24:47 PM: - CONTENTFUL_SPACE_ID 4:24:47 PM: - ENVIRONMENT 4:24:47 PM: - FACETS_INDEX_ID 4:24:47 PM: - GOOGLE_API 4:24:47 PM: - GOOGLE_GEOCODING_API_KEY 4:24:47 PM: - GOOGLE_GEOCODING_URL 4:24:47 PM: - GTM_AUTH 4:24:47 PM: - GTM_PREVIEW 4:24:47 PM: - HUBSPOT_API_KEY 4:24:47 PM: - LOCATIONS_INDEX_ID 4:24:47 PM: - NETLIFY_GRAPH_TOKEN 4:24:47 PM: - NEXT_DISABLE_NETLIFY_EDGE 4:24:47 PM: - NEXT_PUBLIC_GOOGLE_API 4:24:47 PM: - NODE_VERSION 4:24:47 PM: - NPM_FLAGS 4:24:47 PM: - ONEGRAPH_AUTHLIFY_TOKEN 4:24:47 PM: - PAGES_INDEX_ID 4:24:47 PM: - PIM_EXPORT_URL 4:24:47 PM: - POSITIONSTACK_API_KEY 4:24:47 PM: - POSITIONSTACK_URL 4:24:47 PM: - PRODUCTS_INDEX_ID 4:24:47 PM: - SITE_BASE 4:24:47 PM: publish: /opt/build/repo/site/.next 4:24:47 PM: publishOrigin: ui 4:24:47 PM: functionsDirectory: /opt/build/repo/site/netlify/functions 4:24:47 PM: plugins: 4:24:47 PM: - inputs: {} 4:24:47 PM: origin: ui 4:24:47 PM: package: '@netlify/plugin-nextjs' 4:24:48 PM: Caching artifacts 4:24:48 PM: Started saving node modules 4:24:48 PM: Finished saving node modules 4:24:48 PM: Started saving build plugins 4:24:48 PM: Finished saving build plugins 4:24:48 PM: Started saving corepack cache 4:24:48 PM: Finished saving corepack cache 4:24:48 PM: Started saving pip cache 4:24:48 PM: Finished saving pip cache 4:24:48 PM: Started saving emacs cask dependencies 4:24:48 PM: Finished saving emacs cask dependencies 4:24:48 PM: Started saving maven dependencies 4:24:48 PM: Finished saving maven dependencies 4:24:48 PM: Started saving boot dependencies 4:24:48 PM: Finished saving boot dependencies 4:24:48 PM: Started saving rust rustup cache 4:24:48 PM: Finished saving rust rustup cache 4:24:48 PM: Started saving go dependencies 4:24:48 PM: Finished saving go dependencies 4:24:48 PM: Build failed due to a plugin error: Build script returned non-zero exit code: 3 4:24:48 PM: Failing build: Failed to build site 4:24:49 PM: Finished processing build request in 32.239s
I compared this to similar logs from last week (which ran on plugin version v4.29.3), and one early notable difference is this line:
4:24:35 PM: "next" at version "unknown"
(previously this said)
4:32:25 PM: "next" at version "12.3.4"
We had other plugin issues in the past and were able to work around them by specifying a plugin version in package.json, but that did not seem to work for me in a deploy preview. I also attempted to find the area of the Netlify site config where we could specify the plugin version to use, and it seems to have been removed.