Skip to content

Conversation

ovflowd
Copy link
Member

@ovflowd ovflowd commented Oct 11, 2025

This PR is a draft PR for upgrading to Next.js 16.

  • Development Server Works
  • Production Build fails
❯ pnpm build

> @node-core/website@ prebuild /home/cwunder/GitHub/nodejs.org/apps/site
> node --run build:blog-data


> @node-core/website@ build /home/cwunder/GitHub/nodejs.org/apps/site
> node --run build:default -- --turbopack

   ▲ Next.js 16.0.0-beta.0 (Turbopack)
   - Experiments (use with caution):
     ✓ globalNotFound
     · optimizePackageImports
     ✓ parallelServerBuildTraces
     ✓ parallelServerCompiles
     ✓ turbopackFileSystemCacheForDev
     ✓ webpackBuildWorker

   Creating an optimized production build ...
 ✓ Compiled successfully in 5.1s
   Skipping validation of types
 ✓ Collecting page data in 654ms    
Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
Error [PageNotFoundError]: Cannot find module for page: /_document
    at ignore-listed frames {
  code: 'ENOENT'
}
Export encountered an error on /_error: /404, exiting the build.
 ⨯ Next.js build worker exited with code: 1 and signal: null
 ELIFECYCLE  Command failed with exit code 1.

Copy link

vercel bot commented Oct 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nodejs-org Ready Ready Preview Oct 14, 2025 11:21pm

Copy link

codecov bot commented Oct 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.01%. Comparing base (5ebca06) to head (1edcc1c).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8218      +/-   ##
==========================================
- Coverage   76.40%   75.01%   -1.39%     
==========================================
  Files         115      115              
  Lines        9643     9643              
  Branches      317      311       -6     
==========================================
- Hits         7368     7234     -134     
- Misses       2274     2408     +134     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ovflowd
Copy link
Member Author

ovflowd commented Oct 12, 2025

cc @styfle any idea what the prod build failing could be? Pretty much using standard error pages 🤔

@icyJoseph
Copy link

icyJoseph commented Oct 14, 2025

Hi, I haven't fully sorted this out, but I managed to get a "bad" passing build. This was my only attempt and the order of steps was a bit chaotic, so not as linearly as presented here.

I used the --debug-prerender flag on next build, and followed the trace from there.

With that flag I started to see:

Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error
@node-core/website:build: Error: 
@node-core/website:build:     at WithNavBar (turbopack:///[project]/apps/site/components/withNavBar.tsx:43:31)
@node-core/website:build:   41 |   const { resolvedTheme, setTheme } = useTheme();
@node-core/website:build:   42 |   const { replace } = useRouter();
@node-core/website:build: > 43 |   const pathname = usePathname();
@node-core/website:build:      |                               ^

All of the errors reported, pointed at the group of next-intl helpers, Link, usePathname, useRouter from app/site/navigation.mjs - note that I am not claiming a bug on next-intl.

useLocale and useTranslations were also lifted by --debug-prerender.

After replacing the helpers with their original Next.js version, and replacing useLocale() with a string and useTranslations with a dummy function. I hit one more error, /pages somehow requiring _document to be present. To get around this, I renamed the folder pages to _pages and then edited next.dynamic.mjs file to read from _pages:

 const websitePages = await getMarkdownFiles(
    process.cwd(),
    `_pages/${defaultLocale.code}`
  );

With all of that...

Screenshot 2025-10-13 at 22 55 00

I think the path generation is somehow causing all of these to error. At this point, I do not think that we need to change pages to _pages necessarily. It is just a coincident I believe.

Also I am not familiar enough with this repo, so maybe I am building with the wrong .envs.

Note that https://github.com/amannn/next-intl/tree/main/examples/example-app-router w/ next@beta builds without errors too.

Hopefully this gives you some insight. Happy to keep on helping!

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

I think the path generation is somehow causing all of these to error. At this point, I do not think that we need to change pages to _pages necessarily. It is just a coincident I believe.

Sounds like a bug on Next.js imo

All of the errors reported, pointed at the group of next-intl helpers, Link, usePathname, useRouter from app/site/navigation.mjs - note that I am not claiming a bug on next-intl.

Could be that next-intl needs to upgrade to be compatible with Next.js 16? cc @amannn

@icyJoseph
Copy link

Most likely a Next.js thing yeah ~ I'll try to set some time apart later, to try and build by bisecting canaries.

@amannn
Copy link
Contributor

amannn commented Oct 14, 2025

Hey @ovflowd, thanks for pinging me! So yes, as @icyJoseph mentioned, the examples in the next-intl repo all worked flawlessly with the beta without modification. I'll only rename the middleware.ts files to proxy.ts in amannn/next-intl#2054.

The only change I found in Next.js 16 beta that broke something for me was related to parallel routes (see vercel/next.js#84738), but a potential solution was discussed in that thread.

I'll make a note to take a closer look at this PR tomorrow, maybe I can spot something! I'll keep you posted.

@icyJoseph
Copy link

icyJoseph commented Oct 14, 2025

Hello again!

Could someone verify this, I've been doing some canary bisecting and such, and figured out a couple of things.

Building with --webpack, and removing global-not-found.tsx, passes the build. Right?

Building with --turbopack, removing global-not-found.tsx and mving pages to says _pages, passes the build (who knows what other things go wrong). Right?

Edit: I am confident I've found the source of the bug, I just don't understand global-not-found's role on it, just yet, aka, I can reproduce the bug locally but global-not-found is not part of that just yet.

@icyJoseph
Copy link

@amannn sorry for the tag mate, but the mystery is nearly solved.

The global-not-found file on this PR, uses GlowingBackdrop, which in turn uses WithNavBar. The WithNavBar component invokes useSiteNavigation -> useTranslations from next-intl. I guess, it is expected to crash in this scenario? Given the component tree seen from global-not-found?

If we can sort this one out, then --webpack will builds, and we'll likely have a follow up patch to fix --turbopack.

@icyJoseph
Copy link

icyJoseph commented Oct 14, 2025

Got the solution :)

global-not-found is missing <NextIntlClientProvider> - https://next-intl.dev/docs/environments/server-client-components#missing-context

Then --webpack builds will work. There's a bug when --turbopack attempts to not generate any Pages Router files (/_error, /500, etc), if it doesn't detect valid Pages Router pages, but this repo setup triggers a bad branch in the code. We are working on a patch for that.

@avivkeller
Copy link
Member

this repo setup triggers a bad branch in the code. We are working on a patch for that.

We are always happy to bug test dependencies 😃, betas are important!

Thank you!

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

Got the solution :)

global-not-found is missing <NextIntlClientProvider> - next-intl.dev/docs/environments/server-client-components#missing-context

Then --webpack builds will work. There's a bug when --turbopack attempts to not generate any Pages Router files (/_error, /500, etc), if it doesn't detect valid Pages Router pages, but this repo setup triggers a bad branch in the code. We are working on a patch for that.

Weird thing is Turbopack builds were working with Next.js 15 🤔

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

I also found something interesting when creating a pages/404.tsx and a pages/500.tsx and deleting the ones from App Router, it gives this:

> Build error occurred
Error: Turbopack build failed with 1 errors:
./apps/site
App Router and Pages Router both match path: /_not-found
Next.js does not support having both App Router and Pages Router routes matching the same path. Please remove one of the conflicting routes.

Something is clearly bugged/borked on Next.js

@icyJoseph
Copy link

Weird thing is Turbopack builds were working with Next.js 15

Right, in one of the canaries going up to v16, a Turbopack optimization was introduced, where some Pages Router assets are no longer generated, if there's no Pages Router code. How "no Pages Router code" is calculated has a bad branch.

Hopefully a patch will be out soon 🙏

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

I was able to make it work with a very interesting work around. Creating a 404.tsx and 500.tsx, which kinda explains what you just said.

@ovflowd ovflowd added the github_actions:pull-request Trigger Pull Request Checks label Oct 14, 2025
@ovflowd ovflowd marked this pull request as ready for review October 14, 2025 23:16
@ovflowd ovflowd requested a review from a team as a code owner October 14, 2025 23:16
@Copilot Copilot AI review requested due to automatic review settings October 14, 2025 23:16
@ovflowd ovflowd requested a review from a team as a code owner October 14, 2025 23:16
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Oct 14, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades the Next.js framework from version 15.5.4 to 16.0.0-beta.0, bringing support for React 19 and introducing the React Compiler. The upgrade includes configuration changes to support new features and fixes for build issues.

Key changes:

  • Upgraded Next.js to version 16.0.0-beta.0 with React Compiler enabled
  • Added placeholder error pages (404.tsx and 500.tsx) and updated error handling components
  • Migrated from Turbo to Turbopack for build optimization and updated TypeScript JSX configuration

Reviewed Changes

Copilot reviewed 13 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm-workspace.yaml Updated @types/react version for React 19 compatibility
package.json Updated cross-env and globals dependencies
apps/site/tsconfig.json Changed JSX transform and added dev types path
apps/site/pages/500.tsx Added placeholder 500 error page
apps/site/pages/404.tsx Added placeholder 404 error page
apps/site/package.json Upgraded Next.js and related packages, added React Compiler
apps/site/next.config.mjs Enabled React Compiler and Turbopack configurations
apps/site/mdx/plugins.mjs Optimized Shiki plugin as singleton for performance
apps/site/eslint.config.js Updated ESLint Next.js configuration format
apps/site/app/global-error.tsx Removed global error page component
apps/site/app/[locale]/not-found.tsx Converted to server component and simplified UI
apps/site/app/[locale]/error.tsx Simplified error page UI and removed arrow icon
.prettierignore Added next-env.d.ts to ignore list
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

github-actions bot commented Oct 14, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 97 🟠 88 🟢 100 🟢 100 🔗
/en/about 🟢 95 🟢 93 🟢 96 🟠 88 🔗
/en/about/previous-releases 🟢 99 🟢 93 🟢 100 🟢 100 🔗
/en/download 🟢 92 🟢 96 🟢 96 🟢 100 🔗
/en/download/archive/current 🟢 100 🟢 100 🟢 100 🟢 100 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 100 🔗

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

(Although this is just a workaround and it also creates a /500 and /404 route that are empty pages LOL)

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

Weird thing is Turbopack builds were working with Next.js 15

Right, in one of the canaries going up to v16, a Turbopack optimization was introduced, where some Pages Router assets are no longer generated, if there's no Pages Router code. How "no Pages Router code" is calculated has a bad branch.

Hopefully a patch will be out soon 🙏

But yeah a bug fix on upstream would be much appreciated. Apologies for the false alarm, @amannn 🙈

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

Aaand of course Playwright with Cloudflare failed.

@ovflowd
Copy link
Member Author

ovflowd commented Oct 14, 2025

[WebServer] Error: ENOENT: no such file or directory, copyfile '/home/runner/work/nodejs.org/nodejs.org/apps/site/.next/standalone/apps/site/.next/server/chunks/ssr/[root-of-the-server]__4e3e3b3e._.js' -> '/home/runner/work/nodejs.org/nodejs.org/apps/site/.open-next/server-functions/default/apps/site/.next/server/chunks/ssr/[root-of-the-server]__4e3e3b3e._.js'
[WebServer]     at copyFileSync (node:fs:3086:11)
[WebServer]     at file:///home/runner/work/nodejs.org/nodejs.org/node_modules/.pnpm/@opennextjs+aws@3.7.4/node_modules/@opennextjs/aws/dist/build/copyTracedFiles.js:196:13
[WebServer]     at Map.forEach (<anonymous>)
[WebServer]     at copyTracedFiles (file:///home/runner/work/nodejs.org/nodejs.org/node_modules/.pnpm/@opennextjs+aws@3.7.4/node_modules/@opennextjs/aws/dist/build/copyTracedFiles.js:169:17)
[WebServer]     at generateBundle (file:///home/runner/work/nodejs.org/nodejs.org/node_modules/.pnpm/@opennextjs+cloudflare@1.6.4_wrangler@4.33.1/node_modules/@opennextjs/cloudflare/dist/cli/build/open-next/createServerBundle.js:120:60)
[WebServer]     at createServerBundle (file:///home/runner/work/nodejs.org/nodejs.org/node_modules/.pnpm/@opennextjs+cloudflare@1.6.4_wrangler@4.33.1/node_modules/@opennextjs/cloudflare/dist/cli/build/open-next/createServerBundle.js:74:11)
[WebServer]     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
[WebServer]     at async build (file:///home/runner/work/nodejs.org/nodejs.org/node_modules/.pnpm/@opennextjs+cloudflare@1.6.4_wrangler@4.33.1/node_modules/@opennextjs/cloudflare/dist/cli/build/build.js:64:5)
[WebServer]     at async buildCommand (file:///home/runner/work/nodejs.org/nodejs.org/node_modules/.pnpm/@opennextjs+cloudflare@1.6.4_wrangler@4.33.1/node_modules/@opennextjs/cloudflare/dist/cli/commands/build.js:13:5) {
[WebServer]   errno: -2,
[WebServer]   code: 'ENOENT',
[WebServer]   syscall: 'copyfile',
[WebServer]   path: '/home/runner/work/nodejs.org/nodejs.org/apps/site/.next/standalone/apps/site/.next/server/chunks/ssr/[root-of-the-server]__4e3e3b3e._.js',
[WebServer]   dest: '/home/runner/work/nodejs.org/nodejs.org/apps/site/.open-next/server-functions/default/apps/site/.next/server/chunks/ssr/[root-of-the-server]__4e3e3b3e._.js'
[WebServer] }

Much crazier bug, although that could be just OpenNext not being compatible with Next.js 16 yet

@amannn
Copy link
Contributor

amannn commented Oct 15, 2025

@icyJoseph Thanks for getting to the bottom of this! That sounds right to me that you'd have to add another provider instance since global-not-found.tsx doesn't share the one from the usual layout.tsx.

@ovflowd ovflowd marked this pull request as draft October 15, 2025 11:28
@icyJoseph
Copy link

Mmm has this been deployed with Turbopack builds before? I found this issue over at OpenNext opennextjs/opennextjs-cloudflare#569 requesting support for Turbopack 🤔

@ovflowd
Copy link
Member Author

ovflowd commented Oct 15, 2025

Mmm has this been deployed with Turbopack builds before? I found this issue over at OpenNext opennextjs/opennextjs-cloudflare#569 requesting support for Turbopack 🤔

Yes, we use Vercel for deployment and have relied on Turbo for a long time. Our main friction point is the stability of Turbo during Next.js major version upgrades, which consistently necessitates assistance from the Vercel team. We hope to see increased stability in this area—perhaps through the inclusion of more diverse, long-running use cases in Turbopack’s testing regimen. We also ensure broad compatibility by building for OpenNext.

@timneutkens
Copy link

It seems you're misunderstanding where this breaks. It's not in Next.js, it's because Cloudflare uses a custom runtime that is not Node.js (surprised that the Node.js website is not using Node.js). We've worked with the OpenNext team, including other providers to fully support them and are collaborating with all providers on Adapters: https://nextjs.org/blog/next-16-beta#build-adapters-api-alpha. I.e. I opened a PR to make it fully work on Netlify: opennextjs/opennextjs-netlify#2987.

@ovflowd
Copy link
Member Author

ovflowd commented Oct 15, 2025

It's not in Next.js, it's because Cloudflare uses a custom runtime that is

I think there might be a bit of a misunderstanding here. The Cloudflare build failures don’t seem related to the issue we’re discussing in this PR — that one appears to be on the Next.js side (at least based on what @icyJoseph mentioned). Not pointing fingers here, just trying to get early builds of our website running smoothly on the edge. So far, we’ve had great collaboration with the Vercel team in getting things working.

Node.js (surprised that the Node.js website is not using Node.js).

We actually do! The website is deployed on Vercel, which, as far as I understand, runs on Node.js — right? The Cloudflare builds with OpenNext are a fallback.

. We've worked with the OpenNext team, including other providers to fully support them and are collaborating with all providers on Adapters: [nextjs.org/blog/next-16-beta#build-adapters-api-alpha](https://nextjs.org/blog/next-16-beta#build-adapters-api-alpha). I.e. I opened a PR to make it fully work on Netlify: opennextjs/opennextjs-netlify#2987.

That’s awesome :)

@ovflowd
Copy link
Member Author

ovflowd commented Oct 15, 2025

Mmm has this been deployed with Turbopack builds before? I found this issue over at OpenNext opennextjs/opennextjs-cloudflare#569 requesting support for Turbopack 🤔

Yes, we use Vercel for deployment and have relied on Turbo for a long time. Our main friction point is the stability of Turbo during Next.js major version upgrades, which consistently necessitates assistance from the Vercel team. We hope to see increased stability in this area—perhaps through the inclusion of more diverse, long-running use cases in Turbopack’s testing regimen. We also ensure broad compatibility by building for OpenNext.

I also just realised that ChatGPT rephrased this with tons of gibbrish 😅 -- What I was trying to convey is that often when upgrading to newer versions of Next.js we find bugs that break the build, which is completely expected. These are BETA/Canaries and we're more than happy to collaborate (and fortunate enough) that the Vercel team is here supporting us ❤️

The gist of my message regarding Turbopack stability was to question whether more tests could be added on the Turbopack test suite that covers situations such as the one we faced. It could also be that our use case is just too niche, which is fair enough.

Apologies, only realized hours after posting my comment that the rephrasing actually was much worse than my original message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants