Weβve mitigated this issue by locking the build plugin to an earlier version (4.26) - you can do that by adding @netlify/plugin-nextjs@4.26 as a dev dependency.
Make sure you donβt delete the versionless plugin from netlify.toml or it wonβt build.
Thanks for the report. Iβm rolling back the auto-installed version to 4.26.0 while we investigate. Could anyone experiencing this let me know if theyβre using a monorepo, or if thereβs anything unusual about their setup?
Is there are solution for now?
Because it blocks development. Netlify has either a broken version or an old one. Do you have any plugin version for Next that you can recommend?
If yes, then what versions of Next.js and @netlify/plugin-nextjs should I use?
Are there any other requirements?
Or is better not to use βNext.js API routesβ? And replace them Netlify functions?
(Netlify Functions)
I understand, that something may not work. I want to get some recommendations in this area. Working scenario description or description of knowing limitations. Because the more I look into the more I have doubts that it is supposed to work at allβ¦
I tried different versions of @netlify/plugin-nextjs, and different deployment methods(from the console, from the browser interface) with no luck. I either have build errors or runtime errors that say something wrong with bundling or weird cache issues, when I get old code for βAPI Routesβ to be deployed.
About V5, that you suggested, it doesnβt work at all:
(expected as it is in beta)
Plugin "@netlify/plugin-nextjs" failed
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Error message
Error: Failed publishing static content
Plugin details
Package: @netlify/plugin-nextjs
Version: 5.0.0-beta.9
Repository: git+https://github.com/netlify/next-runtime-minimal.git
npm link: https://www.npmjs.com/package/@netlify/plugin-nextjs
Report issues: https://github.com/netlify/next-runtime-minimal/issues
Error location
In "onPostBuild" event in "@netlify/plugin-nextjs" from netlify.toml and package.json
There is no more useful information! netlify CLI and @netlify/plugin-nextjs provide this βhighly unactionable piece of error messageβ as you wrote.
You need to fix it either on the CLI or on the plugin side to provide an βactionableβ error message. And donβt blame users, if they send you a log that is βunactionableβ.
The full log:
PS C:\source\next-js-netlify\nextjs> netlify deploy --prod --build --skip-functions-cache
Netlify Build
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β― Version
@netlify/build 29.35.1
β― Flags
{}
β― Current directory
C:\source\next-js-netlify\nextjs
β― Config file
C:\source\next-js-netlify\nextjs\netlify.toml
β― Context
dev
β― Using Next.js Runtime - v5.0.0-beta.9
Cleaning up leftover files from previous builds
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
(Pre cleanup completed in 4ms)
@netlify/plugin-nextjs (onPreBuild event)
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
(@netlify/plugin-nextjs onPreBuild completed in 14ms)
build.command from netlify.toml
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
$ npm run build
> nextjs@21.5.3 build
> npm-run-all --serial bootstrap next:build
> nextjs@21.5.3 bootstrap
> ts-node --project tsconfig.scripts.json scripts/bootstrap.ts && graphql-let
Registering config plugin computed
Registering config plugin disconnected
Registering config plugin fallback
Registering config plugin package-json
Registering config plugin scjssconfig
Writing config plugins to C:\source\next-js-netlify\nextjs\scripts\temp\config-plugins.ts
Registering sitemap-fetcher plugin disconnected-sitemap-service
Registering sitemap-fetcher plugin graphql-sitemap-service
Writing sitemap-fetcher plugins to C:\source\next-js-netlify\nextjs\src\temp\sitemap-fetcher-plugins.ts
Writing middleware plugins to C:\source\next-js-netlify\nextjs\src\temp\middleware-plugins.ts
Registering page-props-factory plugin component-props
Registering page-props-factory plugin normal-mode
Registering page-props-factory plugin preview-mode
Registering page-props-factory plugin site
Writing page-props-factory plugins to C:\source\next-js-netlify\nextjs\src\temp\page-props-factory-plugins.ts
Registering next-config plugin disconnected
Registering next-config plugin graphql
Registering next-config plugin styleguide
Writing next-config plugins to C:\source\next-js-netlify\nextjs\src\temp\next-config-plugins.js
Writing extract-path plugins to C:\source\next-js-netlify\nextjs\src\temp\extract-path-plugins.ts
Registering site-resolver plugin default
Writing site-resolver plugins to C:\source\next-js-netlify\nextjs\src\temp\site-resolver-plugins.ts
Registering JSS component ContentBlock
Registering JSS component FEaaSWrapper
Registering JSS component Styleguide-FieldUsage-Checkbox
Registering JSS component Styleguide-FieldUsage-ContentList
Registering JSS component Styleguide-FieldUsage-Custom
Registering JSS component Styleguide-FieldUsage-Date
Registering JSS component Styleguide-FieldUsage-File
Registering JSS component Styleguide-FieldUsage-Image
Registering JSS component Styleguide-FieldUsage-ItemLink
Registering JSS component Styleguide-FieldUsage-Link
Registering JSS component Styleguide-FieldUsage-Number
Registering JSS component Styleguide-FieldUsage-RichText
Registering JSS component Styleguide-FieldUsage-Text
Registering JSS component GraphQL-ConnectedDemo.dynamic
Registering JSS component GraphQL-IntegratedDemo
Registering JSS component GraphQL-Layout
Registering JSS component Styleguide-ComponentParams
Registering JSS component Styleguide-CustomRouteType
Registering JSS component Styleguide-EditFrame
Registering JSS component Styleguide-Layout-Reuse
Registering JSS component Styleguide-Layout-Tabs-Tab
Registering JSS component Styleguide-Layout-Tabs
Registering JSS component Styleguide-Layout
Registering JSS component Styleguide-Multilingual
Registering JSS component Styleguide-RouteFields
Registering JSS component Styleguide-Section
Registering JSS component Styleguide-SitecoreContext
Registering JSS component Styleguide-Specimen
Registering JSS component Styleguide-Tracking
Writing component factory to C:\source\next-js-netlify\nextjs\src\temp\componentFactory.ts
Writing runtime config to C:\source\next-js-netlify\nextjs\src\temp\config.js
[ graphql-let ] Nothing to do. Caches for 2 GraphQL documents are fresh.
> nextjs@21.5.3 next:build
> next build
- info Loaded env from C:\source\next-js-netlify\nextjs\.env
- info Linting and checking validity of types
- info Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
- info Using external babel configuration from C:\source\next-js-netlify\nextjs\.babelrc
- warn It looks like there is a custom Babel configuration can be removed .
[ graphql-let ] Nothing to do. Cache was fresh.
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
[ graphql-let ] Nothing to do. Cache was fresh.
- warn Compiled with warnings
./src/lib/sitemap-fetcher/plugins/disconnected-sitemap-service.ts
Module not found: Can't resolve 'sitecore/manifest/sitecore-import.json' in 'C:\source\next-js-netlify\nextjs\src\lib\sitemap-fetcher\plugins'
Import trace for requested module:
./src/lib/sitemap-fetcher/plugins/disconnected-sitemap-service.ts
./src/temp/sitemap-fetcher-plugins.ts
./src/lib/sitemap-fetcher/index.ts
./src/pages/[[...path]].tsx
- info Collecting page data
- info Generating static pages (9/9)
- info Finalizing page optimization
- info Creating an optimized production build .Route (pages) Size First Load JS
β /_app 0 B 91.5 kB
β β /[[...path]] (16296 ms) 109 kB 201 kB
β β /en/graphql (3062 ms)
β β /en/styleguide (2674 ms)
β β /en/graphql/sample-1 (2654 ms)
β β /en/graphql/sample-2 (2653 ms)
β β /en/styleguide/custom-route-type (2640 ms)
β β /en (2613 ms)
β β /404 1.91 kB 93.4 kB
β Ξ» /api/editing/data/[key] 0 B 91.5 kB
β Ξ» /api/editing/render 0 B 91.5 kB
β Ξ» /api/env 0 B 91.5 kB
β Ξ» /api/healthz 0 B 91.5 kB
β Ξ» /api/test 0 B 91.5 kB
+ First Load JS shared by all 119 kB
β chunks/framework-63157d71ad419e09.js 45.2 kB
β chunks/main-e49d4f046eca46f6.js 41.4 kB
β chunks/pages/_app-62a0abcc8bb1479e.js 3.07 kB
β chunks/webpack-dcf2ae1fc51af409.js 1.87 kB
β css/ad2ef081ae3c7779.css 27.7 kB
Ζ Middleware 26.2 kB
Ξ» (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
β (Static) automatically rendered as static HTML (uses no initial props)
β (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
(build.command completed in 55.2s)
@netlify/plugin-nextjs (onBuild event)
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
(@netlify/plugin-nextjs onBuild completed in 5s)
Functions bundling
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Packaging Functions from .netlify\functions-internal directory:
- ___netlify-server-handler\___netlify-server-handler.mjs
No Functions were found in netlify\functions directory
(Functions bundling completed in 14.4s)
Edge Functions bundling
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Packaging Edge Functions from .netlify\edge-functions directory:
- ___netlify-edge-handler-src-middleware
(Edge Functions bundling completed in 4.1s)
@netlify/plugin-nextjs (onPostBuild event)
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
@netlify/plugin-nextjs (onEnd event)
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
(@netlify/plugin-nextjs onEnd completed in 12ms)
Save updated config
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
(options.onEnd completed in 3ms)
Plugin "@netlify/plugin-nextjs" failed
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Error message
Error: Failed publishing static content
Plugin details
Package: @netlify/plugin-nextjs
Version: 5.0.0-beta.9
Repository: git+https://github.com/netlify/next-runtime-minimal.git
npm link: https://www.npmjs.com/package/@netlify/plugin-nextjs
Report issues: https://github.com/netlify/next-runtime-minimal/issues
Error location
In "onPostBuild" event in "@netlify/plugin-nextjs" from netlify.toml and package.json
Resolved config
build:
base: C:\source\next-js-netlify\nextjs
command: npm run build
commandOrigin: config
publish: C:\source\next-js-netlify\nextjs\.next
publishOrigin: config
functionsDirectory: C:\source\next-js-netlify\nextjs\netlify\functions
plugins:
- inputs: {}
origin: config
package: '@netlify/plugin-nextjs'
redirects:
- from: /_next/image
query:
q: ':quality'
url: ':url'
w: ':width'
status: 200
to: /.netlify/images?url=:url&w=:width&q=:quality
redirectsOrigin: inline