opennextjs-netlify: 10.0.8 breaks plugin (can't read config target)

Describe the bug We are experimenting with using netlify-plugin-nextjs instead of next-on-netlify in a yarn monorepo. Unfortunately, when we attempt to deploy with the plugin, we get a Your next.config.js must set the "target" property to one of: serverless, experimental-serverless-trace. Update the target property to allow this plugin to run. message. Attached are two screen shots, one of the next.config.js in question, and the second of the message:

image image

As you can see from the message screenshot, it is console logging This file is detected based on the next.config.js console.log statement, so it sees the correct file. I can also confirm that this is working if we use next-on-netlify directly.

Expected behavior Successful deployment

Versions

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 20

Most upvoted comments

fixed and released in v3.0.0!

@segheysens thanks stephen!! working on it!! requires a big refactor πŸ˜…

hey! timon, since you already have a next config, the plugin does not and cannot attempt to modify it for you. you need to manually update your config to include target: serverless. this is expected behavior of the plugin and unrelated to the 10.0.8 bug πŸ˜ƒ.

Sent from my iPhone

On Mar 14, 2021, at 6:35 PM, Timon Grassl @.***> wrote:

@segheysens Sure, here’s a dummy project (https://github.com/tgrassl/nextjs-netlify-test) and the corresponding build log from Netlify. Did not configure anything else besides installing the Essential Next.js plugin from the UI

11:27:38 PM: Build ready to start 11:27:40 PM: build-image version: 3571f0130496395a23bffe9820bc78b4f73a6234 11:27:40 PM: build-image tag: v3.7.0 11:27:40 PM: buildbot version: c469f7ab4d394d961ca036b1163fdbb6ef9fb78c 11:27:40 PM: Building without cache 11:27:40 PM: Starting to prepare the repo for build 11:27:40 PM: No cached dependencies found. Cloning fresh repo 11:27:40 PM: git clone https://github.com/tgrassl/nextjs-netlify-test 11:27:42 PM: Preparing Git Reference refs/heads/main 11:27:43 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: β€˜out’ versus β€˜out/’ in the Netlify UI 11:27:43 PM: Starting build script 11:27:43 PM: Installing dependencies 11:27:43 PM: Python version set to 2.7 11:27:45 PM: v12.18.0 is already installed. 11:27:45 PM: Now using node v12.18.0 (npm v6.14.4) 11:27:45 PM: Started restoring cached build plugins 11:27:45 PM: Finished restoring cached build plugins 11:27:46 PM: Attempting ruby version 2.7.1, read from environment 11:27:47 PM: Using ruby version 2.7.1 11:27:48 PM: Using PHP version 5.6 11:27:48 PM: Started restoring cached node modules 11:27:48 PM: Finished restoring cached node modules 11:27:48 PM: Installing NPM modules using NPM version 6.14.4 11:27:56 PM: > @.*** postinstall /opt/build/repo/node_modules/core-js 11:27:56 PM: > node -e β€œtry{require(β€˜./postinstall’)}catch(e){}” 11:27:56 PM: npm WARN @.*** No description 11:27:56 PM: npm WARN @.*** No repository field. 11:27:56 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @.*** (node_modules/fsevents): 11:27:56 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @.: wanted {β€œos”:β€œdarwin”,β€œarch”:β€œany”} (current: {β€œos”:β€œlinux”,β€œarch”:β€œx64”}) 11:27:56 PM: added 251 packages from 251 contributors and audited 253 packages in 7.411s 11:27:56 PM: 16 packages are looking for funding 11:27:56 PM: run npm fund for details 11:27:56 PM: found 0 vulnerabilities 11:27:56 PM: NPM modules installed 11:27:57 PM: Started restoring cached go cache 11:27:57 PM: Finished restoring cached go cache 11:27:57 PM: go version go1.14.4 linux/amd64 11:27:57 PM: go version go1.14.4 linux/amd64 11:27:57 PM: Installing missing commands 11:27:57 PM: Verify run directory 11:27:59 PM: ​ 11:27:59 PM: ──────────────────────────────────────────────────────────────── 11:27:59 PM: Netlify Build
11:27:59 PM: ──────────────────────────────────────────────────────────────── 11:27:59 PM: ​ 11:27:59 PM: ❯ Version 11:27:59 PM: @netlify/build 9.9.5 11:27:59 PM: ​ 11:27:59 PM: ❯ Flags 11:27:59 PM: apiHost: api.netlify.com 11:27:59 PM: cacheDir: /opt/build/cache 11:27:59 PM: deployId: 604e8ddaa9112ef8d84f9f3e 11:27:59 PM: mode: buildbot 11:27:59 PM: testOpts: 11:27:59 PM: silentLingeringProcesses: β€˜β€™ 11:27:59 PM: ​ 11:27:59 PM: ❯ Current directory 11:27:59 PM: /opt/build/repo 11:27:59 PM: ​ 11:27:59 PM: ❯ Config file 11:27:59 PM: No config file was defined: using default values. 11:27:59 PM: ​ 11:27:59 PM: ❯ Context 11:27:59 PM: production 11:27:59 PM: ​ 11:27:59 PM: ❯ Installing plugins 11:27:59 PM: - @
@. 11:28:20 PM: ​ 11:28:20 PM: ❯ Loading plugins 11:28:20 PM: - @@.*** from Netlify app 11:28:20 PM: ​ 11:28:20 PM: ──────────────────────────────────────────────────────────────── 11:28:20 PM: 1. onPreBuild command from @netlify/plugin-nextjs
11:28:20 PM: ──────────────────────────────────────────────────────────────── 11:28:20 PM: ​ 11:28:21 PM: Your next.config.js must set the β€œtarget” property to one of: serverless, experimental-serverless-trace. Update the 11:28:21 PM: target property to allow this plugin to run. 11:28:21 PM: ​ 11:28:21 PM: @./plugin-nextjs onPreBuild completed in 828ms) 11:28:21 PM: ​ 11:28:21 PM: ──────────────────────────────────────────────────────────────── 11:28:21 PM: 2. Build command from Netlify app
11:28:21 PM: ──────────────────────────────────────────────────────────────── 11:28:21 PM: ​ 11:28:21 PM: $ npm run build 11:28:22 PM: > @.
build /opt/build/repo 11:28:22 PM: > next build 11:28:23 PM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://err.sh/next.js/no-cache 11:28:23 PM: info - Creating an optimized production build… 11:28:43 PM: info - Compiled successfully 11:28:43 PM: info - Collecting page data… 11:28:44 PM: info - Generating static pages (0/10) 11:28:46 PM: info - Generating static pages (2/10) 11:28:46 PM: info - Generating static pages (4/10) 11:28:46 PM: info - Generating static pages (7/10) 11:28:46 PM: info - Generating static pages (10/10) 11:28:46 PM: info - Finalizing page optimization… 11:28:46 PM: Page Size First Load JS 11:28:46 PM: β”Œ ● / 472 B 84 kB 11:28:46 PM: β”œ /_app 0 B 79.8 kB 11:28:46 PM: β”œ β—‹ /404 2.72 kB 82.5 kB 11:28:46 PM: β”” ● /second-page 395 B 83.9 kB 11:28:46 PM: + First Load JS shared by all 79.8 kB 11:28:46 PM: β”œ chunks/08b56c1779dbdbb0e3e8dbde9a3df2a9ca8dae00.da1aa7.js 16 kB 11:28:46 PM: β”œ chunks/commons.5e5c3a.js 14.4 kB 11:28:46 PM: β”œ chunks/framework.9d5241.js 41.8 kB 11:28:46 PM: β”œ chunks/main.31e598.js 6.39 kB 11:28:46 PM: β”œ chunks/pages/_app.fb42d0.js 496 B 11:28:46 PM: β”” chunks/webpack.50bee0.js 751 B 11:28:46 PM: Ξ» (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps) 11:28:46 PM: β—‹ (Static) automatically rendered as static HTML (uses no initial props) 11:28:46 PM: ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps) 11:28:46 PM: (ISR) incremental static regeneration (uses revalidate in getStaticProps) 11:28:46 PM: ​ 11:28:46 PM: (build.command completed in 25.1s) 11:28:46 PM: ​ 11:28:46 PM: ──────────────────────────────────────────────────────────────── 11:28:46 PM: 3. onBuild command from @netlify/plugin-nextjs
11:28:46 PM: ──────────────────────────────────────────────────────────────── 11:28:46 PM: ​ 11:28:46 PM: Your next.config.js must set the β€œtarget” property to one of: serverless, experimental-serverless-trace. Update the 11:28:46 PM: target property to allow this plugin to run. 11:28:46 PM: ​ 11:28:46 PM: @./plugin-nextjs onBuild completed in 5ms) 11:28:46 PM: ​ 11:28:46 PM: ──────────────────────────────────────────────────────────────── 11:28:46 PM: 4. Deploy site
11:28:46 PM: ──────────────────────────────────────────────────────────────── 11:28:46 PM: ​ 11:28:46 PM: ​ 11:28:46 PM: ──────────────────────────────────────────────────────────────── 11:28:46 PM: Configuration error
11:28:46 PM: ──────────────────────────────────────────────────────────────── 11:28:46 PM: ​ 11:28:46 PM: Error message 11:28:46 PM: Deploy did not succeed: Deploy directory β€˜out’ does not exist 11:28:46 PM: ​ 11:28:46 PM: Resolved config 11:28:46 PM: build: 11:28:46 PM: command: npm run build 11:28:46 PM: commandOrigin: ui 11:28:46 PM: publish: /opt/build/repo/out 11:28:46 PM: plugins: 11:28:46 PM: - inputs: {} 11:28:46 PM: origin: ui 11:28:46 PM: package: @.
/plugin-nextjs’ 11:28:47 PM: Caching artifacts 11:28:47 PM: Started saving node modules 11:28:47 PM: Finished saving node modules 11:28:47 PM: Started saving build plugins 11:28:47 PM: Finished saving build plugins 11:28:47 PM: Started saving pip cache 11:28:47 PM: Finished saving pip cache 11:28:47 PM: Started saving emacs cask dependencies 11:28:47 PM: Finished saving emacs cask dependencies 11:28:47 PM: Started saving maven dependencies 11:28:47 PM: Finished saving maven dependencies 11:28:47 PM: Started saving boot dependencies 11:28:47 PM: Finished saving boot dependencies 11:28:47 PM: Started saving rust rustup cache 11:28:47 PM: Finished saving rust rustup cache 11:28:47 PM: Started saving go dependencies 11:28:47 PM: Finished saving go dependencies 11:28:49 PM: Build script success 11:29:07 PM: Finished processing build request in 1m26.655546342s β€” You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

I think I ran into a similar problem today with deploying next js 10.0.8. Nice work jumping on it so quickly!