Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
10.69.0
Framework Version
Next.js 16.3.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
No response
Steps to Reproduce
- Next.js app with
output: "standalone" and withSentryConfig.
- Initialize the server SDK from
instrumentation.ts.
next build, then run the standalone server (node .next/standalone/server.js, or deploy the standalone output).
- Observe the runtime failure resolving
meriyah/dist/meriyah.mjs; confirm meriyah.cjs is present in the traced output but meriyah.mjs is not.
Expected Result
The standalone build includes every file @sentry/server-utils needs at runtime, including meriyah/dist/meriyah.mjs.
Actual Result
Only meriyah/dist/meriyah.cjs is traced into the standalone output; the ESM entry loaded at runtime needs meriyah.mjs → ERR_MODULE_NOT_FOUND.
Additional Context
After bumping @sentry/nextjs/@sentry/node from 10.37.0 to 10.69.0, the standalone server build fails at runtime with a missing-module error for:
.../node_modules/.pnpm/meriyah@6.1.4/node_modules/meriyah/dist/meriyah.mjs
The standalone output contains meriyah/dist/meriyah.cjs but not meriyah/dist/meriyah.mjs, so the ESM entry that gets loaded at runtime cannot resolve the parser.
Root cause analysis
meriyah entered the dependency graph at @sentry/node@10.59.0 (first version whose @sentry/server-utils@10.59.0 depends on @apm-js-collab/code-transformer@^0.15.0, which depends on meriyah@^6.1.4). As of server-utils@10.68.0+, meriyah is also a direct dependency of @sentry/server-utils.
@sentry/server-utils is dual-published, and its ESM build imports meriyah:
// @sentry/server-utils/build/esm/orchestrion/bundler/subscribeInjection.js
import { parse } from 'meriyah';
meriyah@6.1.4's package.json has an unusual exports map:
Note there is no plain import key (the ESM side lives under module-sync + default), and require is ordered before default.
Next.js output file tracing (@vercel/nft) resolves specifiers with a condition set that includes both import and require. Because exports matching is first-match-in-insertion-order and require appears before default, nft resolves meriyah to the require → dist/meriyah.cjs target and copies only that into the standalone bundle. Node's real ESM loader, resolving the same import, does not have the require condition active, so it falls through to module-sync/default → dist/meriyah.mjs, which was never traced/copied.
Result: nft's traced file set and Node's runtime resolution diverge for this one dual package, so meriyah.mjs is absent from output: "standalone".
Workaround
Force-include the missing file via next.config:
outputFileTracingIncludes: {
"/*": ["../node_modules/.pnpm/meriyah@*/node_modules/meriyah/dist/*.mjs"],
},
Fixes
- Have
withSentryConfig add the required @sentry/server-utils runtime files (notably meriyah's .mjs) to outputFileTracingIncludes automatically, the same way other packages that trip nft are handled.
- Fix this upstream, in either
@vercel/nft or meriyah
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
10.69.0
Framework Version
Next.js 16.3.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
No response
Steps to Reproduce
output: "standalone"andwithSentryConfig.instrumentation.ts.next build, then run the standalone server (node .next/standalone/server.js, or deploy the standalone output).meriyah/dist/meriyah.mjs; confirmmeriyah.cjsis present in the traced output butmeriyah.mjsis not.Expected Result
The standalone build includes every file
@sentry/server-utilsneeds at runtime, includingmeriyah/dist/meriyah.mjs.Actual Result
Only
meriyah/dist/meriyah.cjsis traced into the standalone output; the ESM entry loaded at runtime needsmeriyah.mjs→ERR_MODULE_NOT_FOUND.Additional Context
After bumping
@sentry/nextjs/@sentry/nodefrom10.37.0to10.69.0, the standalone server build fails at runtime with a missing-module error for:The standalone output contains
meriyah/dist/meriyah.cjsbut notmeriyah/dist/meriyah.mjs, so the ESM entry that gets loaded at runtime cannot resolve the parser.Root cause analysis
meriyahentered the dependency graph at@sentry/node@10.59.0(first version whose@sentry/server-utils@10.59.0depends on@apm-js-collab/code-transformer@^0.15.0, which depends onmeriyah@^6.1.4). As ofserver-utils@10.68.0+,meriyahis also a direct dependency of@sentry/server-utils.@sentry/server-utilsis dual-published, and its ESM build imports meriyah:meriyah@6.1.4'spackage.jsonhas an unusualexportsmap:Note there is no plain
importkey (the ESM side lives undermodule-sync+default), andrequireis ordered beforedefault.Next.js output file tracing (
@vercel/nft) resolves specifiers with a condition set that includes bothimportandrequire. Becauseexportsmatching is first-match-in-insertion-order andrequireappears beforedefault, nft resolvesmeriyahto therequire→dist/meriyah.cjstarget and copies only that into the standalone bundle. Node's real ESM loader, resolving the sameimport, does not have therequirecondition active, so it falls through tomodule-sync/default→dist/meriyah.mjs, which was never traced/copied.Result: nft's traced file set and Node's runtime resolution diverge for this one dual package, so
meriyah.mjsis absent fromoutput: "standalone".Workaround
Force-include the missing file via
next.config:Fixes
withSentryConfigadd the required@sentry/server-utilsruntime files (notablymeriyah's.mjs) tooutputFileTracingIncludesautomatically, the same way other packages that trip nft are handled.@vercel/nftormeriyahPriority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it.