next.js: Prerender error with minify enabled
Link to the code that reproduces this issue
https://github.com/KDederichs/sentry_next_reproducer
To Reproduce
Not sure what changed, I updated Nextjs from 13.4.19 to 13.5.4 and suddenly builds fail when minify is enabled. Suddenly I’m getting errors like this on build:
✓ Creating an optimized production build
✓ Compiled successfully
Skipping linting
✓ Checking validity of types
✓ Collecting page data
Generating static pages (0/23) [ ] ⚠ Entire page /social-login/error deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /social-login/error
⚠ Entire page /reset deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /reset
Generating static pages (0/23) [= ] ⚠ Entire page /social-login/success deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /social-login/success
⚠ Entire page /user/coins deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /user/coins
Generating static pages (16/23) [== ]
{}
TypeError: ie is not a function
at <PATH_REPLACED>.next/server/chunks/888.js:1:13486
at Array.filter (<anonymous>)
at <PATH_REPLACED>.next/server/chunks/888.js:1:13453
at <PATH_REPLACED>.next/server/chunks/888.js:1:13504
at Object.rZ [as useMemo] (<PATH_REPLACED>node_modules/.pnpm/next@13.5.4_@babel+core@7.23.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:27:30300)
at t.useMemo (<PATH_REPLACED>node_modules/.pnpm/next@13.5.4_@babel+core@7.23.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:75:7338)
at de (<PATH_REPLACED>.next/server/chunks/888.js:1:13298)
at AvatarDropzone (<PATH_REPLACED>.next/server/app/user/settings/page.js:1:4793)
at nd (<PATH_REPLACED>node_modules/.pnpm/next@13.5.4_@babel+core@7.23.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:27:35308)
at nh (<PATH_REPLACED>node_modules/.pnpm/next@13.5.4_@babel+core@7.23.0_react-dom@18.2.0_react@18.2.0/node
Error occurred prerendering page "/user/settings". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: ie is not a function
at <PATH_REPLACED>.next/server/chunks/888.js:1:13486
at Array.filter (<anonymous>)
at <PATH_REPLACED>.next/server/chunks/888.js:1:13453
at <PATH_REPLACED>.next/server/chunks/888.js:1:13504
at Object.rZ [as useMemo] (<PATH_REPLACED>node_modules/.pnpm/next@13.5.4_@babel+core@7.23.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:27:30300)
at t.useMemo (<PATH_REPLACED>node_modules/.pnpm/next@13.5.4_@babel+core@7.23.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:75:7338)
at de (<PATH_REPLACED>.next/server/chunks/888.js:1:13298)
at AvatarDropzone (<PATH_REPLACED>.next/server/app/user/settings/page.js:1:4793)
at nd (<PATH_REPLACED>node_modules/.pnpm/next@13.5.4_@babel+core@7.23.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:27:35308)
at nh (<PATH_REPLACED>node_modules/.pnpm/next@13.5.4_@babel+core@7.23.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/c
✓ Generating static pages (23/23)
Current vs. Expected behavior
I’d expect it to build regardless of minification.
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:34 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T8103
Binaries:
Node: 18.13.0
npm: 9.6.7
Yarn: 1.22.19
pnpm: 8.7.4
Relevant Packages:
next: 13.5.4
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: 5.2.2
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Additional context
Looks like 13.5.3 still works, so it has to be something that happened in 13.5.4
Note: Reproducer link is completely unrelated, I just don’t want this closed again -.- If you REALLY REALLY REALLY need one, I’ll try to dig and see what minification fails now but I’d rather not.
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 16 (4 by maintainers)
Commits related to this issue
- fix(es/minifier): Abort function inliner if `keep_fnames` is `true` (#8145) **Related issue:** - https://github.com/vercel/next.js/issues/56408 — committed to swc-project/swc by kdy1 8 months ago
- Update `swc_core` to `v0.86.10` (#57121) ### What? Update SWC crates. This PR fixes a regression of `swc_core`. The important PR: https://github.com/swc-project/swc/pull/8153 ### Why? There... — committed to vercel/next.js by kdy1 8 months ago
Thank you, that’s very helpful! So this is likely a result of #56281, we will look into it!
Please always assume that we need an actual reproduction from the get-go. 🙏 💚
@balazsorban44 https://github.com/KDederichs/next-minify-error-reproducer there you go just run
npm run buildfor the error(s) looks like in the latest canary build some strange cookie error gets thrown in addition as well 😄Edit: I updated the reproducer to the correct canary version so it’s only that error. Error first happens in
13.5.4-canary.9I also have similar issue, using react-dropzone’s useDropzone hook with a proper accept parameter fails on minify; similarly fixed by reverting next.js to 13.5.3
Oh yeah I have react-dropzone on that page as well, so probably the root cause for me as well.