Turbopack: trace externals imported only by server actions#95824
Merged
Conversation
Contributor
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URLCommit: 8faa9c3 |
Contributor
Tests PassedCommit: 8faa9c3 |
mischnic
marked this pull request as ready for review
July 16, 2026 05:10
mischnic
approved these changes
Jul 16, 2026
mischnic
left a comment
Member
There was a problem hiding this comment.
Thankfully these annoying additional_entries will be removed soon anyway.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#95815 refactored the NFT flow and ended up only tracing the RSC template and it's subgraph. Not the server actions loader module whose module graph is completely separate.
Clauded.
Attempts to fix #95130 (reply in thread).
Details
Summary
Fixes the NFT tracing regression behind #95815 and the deploy failures reported in #87737 (comment).
Since the 16.3 NFT rewrite (#94224 / #92901), a
serverExternalPackagesentry that is imported only from a'use server'action referenced by a client component ends up in the route's trace as the content-hashed alias symlink (.next/node_modules/<pkg>-<hash>) without the store files the symlink points to. Any output assembled from the traces (Vercel lambdas,output: 'standalone') then contains a dangling symlink, and invoking the action throwsFailed to load external module <pkg>-<hash>(HTTP 500). 16.2.9 traces both. Both CJS and ESM externals are affected, with any package manager — the ESM/bun/monorepo framing in the issue reports was a coincidence of which packages were only reachable through actions.The cause:
AppEndpoint::trace_resultstarted the trace DFS only fromrsc_entry, but the server actions loader is a separate module-graph entry (additional_entries). It is chunked into the endpoint output (which emits the alias symlink via the chunk's output assets), yet its subgraph — including the externals' traced target files — was never visited by the tracer.trace_endpointnow accepts multiple entry modules and the app endpoint passes the actions loader alongsidersc_entry.The test observes the user-visible failure: it builds with
output: 'standalone', deletes everything except the standalone output (so only traced files are available, like a deployed lambda), runsserver.js, and invokes the server action in a browser. Without the fix the action fails withFailed to load external module lodash-<hash>; on 16.2.9 the same fixture responds with the action result. Note the fixture must not import the externals from any other route: the standalone output is the union of all route traces, so a route that traces them correctly would mask the missing entries.Verification
pnpm test-start-turbo test/production/standalone-mode/server-action-externals/standalone-mode-server-action-externals.test.ts— fails without the fix (Failed to load external module lodash-fb78ad0536ffcdabfrom the standalone server), passes with it. The equivalent standalone flow onnext@16.2.9returns the action result with HTTP 200.pnpm test-start-turbo test/e2e/externals-transitive/externals-transitive.test.tspnpm test-start-turbo test/production/standalone-mode/server-actions/standalone-mode-server-actions.test.ts