@vercel/next: Next 16.2+/Turbopack functions crash at runtime: Cannot find module 'next/dist/server/lib/incremental-cache/tags-manifest.external.js'
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 16.3k
- Forks
- 3.8k
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
Summary
Deploying a Next.js app on Next 16.2.x or 16.3.x (Turbopack build, the default) produces serverless functions that crash on every request at module load:
Error: Failed to load external module next/dist/compiled/next-server/app-route-turbo.runtime.prod.js:
Error: Cannot find module 'next/dist/server/lib/incremental-cache/tags-manifest.external.js'
Require stack:
- /var/task/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js
- /var/task/.next/server/chunks/[root-of-the-server]__....js
- /var/task/.next/server/chunks/[turbopack]_runtime.js
- /var/task/.next/server/app/api/<route>/route.js
- /var/task/___next_launcher.cjs
The same happens for pages via app-page-turbo.runtime.prod.js. Result: every node function returns 500; the build itself is green.
Evidence it is the function tracer, not the app
next/dist/server/lib/incremental-cache/tags-manifest.external.jsexists in the publishednextpackage for these versions (verified in local node_modules), andapp-route-turbo.runtime.prod.jsreferences it.- Local
next buildcompletes cleanly; only the deployed functions fail, i.e. the file is dropped when the lambda'snode_modules/next/distis pruned to traced files. The.external.jsmodules are loaded through the Turbopack runtime'sexternalRequire, which the tracer evidently cannot see. - Controlled comparison on the same commit, same project, four deploys: next 16.1.4 works; 16.2.12 and 16.3.3 both crash with the error above.
- No user-side workaround exists:
outputFileTracingIncludesis not applied under Turbopack builds (build/index.jsonly callscollect-build-traceswhen the bundler is not Turbopack), and building with--webpackis not viable for apps with dependencies that rely on Turbopack's tolerance of dangling imports.
Expected
The @vercel/next builder includes the *.external.js runtime modules (at minimum next/dist/server/lib/incremental-cache/** and siblings) that Next >= 16.2 requires at runtime from its compiled turbo runtimes.
Environment
- next: 16.2.12 / 16.3.3 (broken), 16.1.4 (works)
- Build:
next build(Turbopack default), deployed via git integration and CLI, identical result - Runtime: Node 22 serverless functions
Happy to provide additional detail. Filing here since the failure is in function packaging at deploy time; if this belongs in vercel/next.js instead, please redirect.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in build/index.js, where collect-build-traces is only called for non-Turbopack builds, and trace the @vercel/next function packaging path. Reproduce with a Next 16.2.x or 16.3.x Turbopack deployment and inspect which next/dist/server/lib/incremental-cache/*.external.js files are included. Done means the deployed serverless function loads and serves requests without the missing-module error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, node.js, typescript
- Domain
- build-system, cloud, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100