Closed
Description
Describe the bug
👋 Hey folks. I’m running into the bug described in netlify/next-on-netlify#137. I’m not sure what caused the regression, but it seems not-unlikely that it’s related to building a Next app from within a monorepo. I get the same error logs running netlify build
locally and running a build in the Netlify cloud environment:
Build logs
5:34:24 AM: ────────────────────────────────────────────────────────────────
5:34:24 AM: Netlify Build
5:34:24 AM: ────────────────────────────────────────────────────────────────
5:34:24 AM:
5:34:24 AM: ❯ Version
5:34:24 AM: @netlify/build 9.13.2
5:34:24 AM:
5:34:24 AM: ❯ Flags
5:34:24 AM: apiHost: api.netlify.com
5:34:24 AM: cacheDir: /opt/build/cache
5:34:24 AM: deployId: 605c58629c09110008c8d7aa
5:34:24 AM: mode: buildbot
5:34:24 AM: testOpts:
5:34:24 AM: silentLingeringProcesses: ''
5:34:24 AM:
5:34:24 AM: ❯ Current directory
5:34:24 AM: /opt/build/repo/packages/web
5:34:24 AM:
5:34:24 AM: ❯ Config file
5:34:24 AM: No config file was defined: using default values.
5:34:24 AM:
5:34:24 AM: ❯ Context
5:34:24 AM: production
5:34:24 AM:
5:34:24 AM: ❯ Loading plugins
5:34:24 AM: - @netlify/plugin-nextjs@3.0.3 from Netlify app and package.json
5:34:25 AM:
5:34:25 AM: ────────────────────────────────────────────────────────────────
5:34:25 AM: 1. onPreBuild command from @netlify/plugin-nextjs
5:34:25 AM: ────────────────────────────────────────────────────────────────
5:34:25 AM:
5:34:26 AM:
5:34:26 AM: (@netlify/plugin-nextjs onPreBuild completed in 1.3s)
5:34:26 AM:
5:34:26 AM: ────────────────────────────────────────────────────────────────
5:34:26 AM: 2. Build command from Netlify app
5:34:26 AM: ────────────────────────────────────────────────────────────────
5:34:26 AM:
5:34:26 AM: $ yarn build
5:34:32 AM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://err.sh/next.js/no-cache
5:34:32 AM: info - Creating an optimized production build...
5:34:38 AM: info - Using external babel configuration from /opt/build/repo/packages/web/.babelrc.js
5:35:17 AM: info - Compiled successfully
5:35:17 AM: info - Collecting page data...
5:35:19 AM: info - Generating static pages (0/6)
5:35:21 AM: info - Generating static pages (1/6)
5:35:21 AM: info - Generating static pages (2/6)
5:35:22 AM: info - Generating static pages (4/6)
5:35:22 AM: info - Generating static pages (6/6)
5:35:22 AM: info - Finalizing page optimization...
5:35:22 AM: Page Size First Load JS
5:35:22 AM: ┌ ○ / 285 B 106 kB
5:35:22 AM: ├ /_app 0 B 106 kB
5:35:22 AM: ├ ○ /404 2.26 kB 108 kB
5:35:22 AM: ├ λ /api/transcriptions 0 B 106 kB
5:35:22 AM: ├ ○ /search 25 kB 131 kB
5:35:22 AM: ├ ○ /videos 912 B 126 kB
5:35:22 AM: └ ○ /videos/[id] 1.07 kB 127 kB
5:35:22 AM: + First Load JS shared by all 106 kB
5:35:22 AM: ├ chunks/392.dc4a5d.js 8.66 kB
5:35:22 AM: ├ chunks/493.bb6b42.js 13.8 kB
5:35:22 AM: ├ chunks/635.907d59.js 29.9 kB
5:35:22 AM: ├ chunks/framework.780ba5.js 42.4 kB
5:35:22 AM: ├ chunks/main.da1955.js 5.83 kB
5:35:22 AM: ├ chunks/pages/_app.59ac67.js 4.16 kB
5:35:22 AM: ├ chunks/webpack.cf1bed.js 1.08 kB
5:35:22 AM: └ css/8cfbea2b33fe865bac7f.css 21.2 kB
5:35:22 AM: λ (Lambda) server-side renders at runtime (uses getInitialProps or getServerSideProps)
5:35:22 AM: ○ (Static) automatically rendered as static HTML (uses no initial props)
5:35:22 AM: ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
5:35:22 AM: (ISR) incremental static regeneration (uses revalidate in getStaticProps)
5:35:22 AM:
5:35:22 AM: (build.command completed in 56.2s)
5:35:22 AM:
5:35:22 AM: ────────────────────────────────────────────────────────────────
5:35:22 AM: 3. onBuild command from @netlify/plugin-nextjs
5:35:22 AM: ────────────────────────────────────────────────────────────────
5:35:22 AM:
5:35:22 AM: ** Running Next on Netlify package **
5:35:22 AM: 🚀 Next on Netlify 🚀
5:35:22 AM: 🌍️ Copying public/ folder to public
5:35:22 AM:
5:35:22 AM: ────────────────────────────────────────────────────────────────
5:35:22 AM: Plugin "@netlify/plugin-nextjs" internal error
5:35:22 AM: ────────────────────────────────────────────────────────────────
5:35:22 AM:
5:35:22 AM: Error message
5:35:22 AM: Error: Source and destination must not be the same.
5:35:22 AM:
5:35:22 AM: Plugin details
5:35:22 AM: Package: @netlify/plugin-nextjs
5:35:22 AM: Version: 3.0.3
5:35:22 AM: Repository: git+https://github.com/netlify/netlify-plugin-nextjs.git
5:35:22 AM: npm link: https://www.npmjs.com/package/@netlify/plugin-nextjs
5:35:22 AM: Report issues: https://github.com/netlify/netlify-plugin-nextjs/issues
5:35:22 AM:
5:35:22 AM: Error location
5:35:22 AM: In "onBuild" event in "@netlify/plugin-nextjs" from Netlify app and package.json
5:35:22 AM: at Object.checkPathsSync (/opt/build/repo/node_modules/fs-extra/lib/util/stat.js:51:11)
5:35:22 AM: at copySync (/opt/build/repo/node_modules/fs-extra/lib/copy-sync/copy-sync.js:24:38)
5:35:22 AM: at copyPublicFiles (/opt/build/repo/node_modules/@netlify/plugin-nextjs/src/lib/steps/copyPublicFiles.js:13:5)
5:35:22 AM: at build (/opt/build/repo/node_modules/@netlify/plugin-nextjs/src/index.js:23:3)
5:35:22 AM: at nextOnNetlify (/opt/build/repo/node_modules/@netlify/plugin-nextjs/src/index.js:75:11)
5:35:22 AM: at onBuild (/opt/build/repo/node_modules/@netlify/plugin-nextjs/index.js:59:11)
5:35:22 AM: at async Object.run (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/run.js:18:3)
5:35:22 AM: at async handleEvent (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/main.js:36:38)
5:35:22 AM: at async process.<anonymous> (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/ipc.js:103:16)
5:35:22 AM:
5:35:22 AM: Resolved config
5:35:22 AM: build:
5:35:22 AM: base: /opt/build/repo/packages/web
5:35:22 AM: command: yarn build
5:35:22 AM: commandOrigin: ui
5:35:22 AM: environment:
5:35:22 AM: - ALGOLIA_APPLICATION_ID
5:35:22 AM: - ALGOLIA_INDEX
5:35:22 AM: - ALGOLIA_SEARCH_KEY
5:35:22 AM: - NETLIFY_USE_YARN
5:35:22 AM: - NEXT_PUBLIC_ALGOLIA_APPLICATION_ID
5:35:22 AM: - NEXT_PUBLIC_ALGOLIA_INDEX
5:35:22 AM: - NEXT_PUBLIC_ALGOLIA_SEARCH_KEY
5:35:22 AM: - NODE_VERSION
5:35:22 AM: publish: /opt/build/repo/packages/web/public
5:35:22 AM: plugins:
5:35:22 AM: - inputs: {}
5:35:22 AM: origin: ui
5:35:22 AM: package: '@netlify/plugin-nextjs'
The repo I’m working with is here, in case that’s useful; the Next app within the monorepo is located here.
Thanks for taking a look. Let me know if I can provide any additional color.
To Reproduce
Steps to reproduce the behavior:
- Configure Netlify to build a Next.js app in a monorepo, setting the “Base Directory” to the package path and the “Publish Directory” to the
public
folder underneath the package root. - Add static assets to the
public
folder. - Push to Netlify.
- 💥
Expected behavior
Netlify should build and deploy the Next.js application.
Versions
- Next.js:
v10.0.9
- plugin (if installed at fixed version):
v3.0.3
If you’re using the CLI to build
- OS: Ubuntu Bullseye
- netlify/cli version:
v3.13.7
If you’re using file-based installation
- netlify.toml: N/A