mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #347] rscOnError silently swallows Server Component errors in production — reportRequestError is a no-op #80
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#80
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Jbithell on GitHub (Mar 8, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/347
Summary
In production builds, Server Component render errors are silently swallowed.
rscOnErrorgenerates a digest but never logs or reports the original error, andreportRequestErroris a no-op in the production entry point. This makes it impossible for error-tracking services (e.g. Sentry) to capture the real error — they only see the sanitised message React sends to the client:Details
rscOnErrordoesn't log errorsIn the production bundle,
rscOnErroronly generates a digest hash and returns it. ForErrorinstances it never callsconsole.error,reportRequestError, or any other reporting mechanism:Compare this to the dev server (
app-dev-server.ts) which calls_reportRequestError(error)for server actions — but even there,rscOnErroritself doesn't report errors.reportRequestErroris a no-op in productionThe production entry point (
prod-server.js) contains:Even if
rscOnErrorwere to callreportRequestError, it would do nothing. Theinstrumentation.tsonRequestErrorhook is loaded but never wired into the production code path.Expected behaviour
rscOnErrorshould callconsole.error(error)(like React's own SSR renderer does) and/or callreportRequestErrorso the original error is observablereportRequestErrorshould actually invokeonRequestErrorfrominstrumentation.tsin production builds, not be a no-oponRequestErrorinstrumentation hook should be wired into the production entry pointWorkaround
We're using a Vite
renderChunkplugin to patchrscOnErrorin the final bundle to injectconsole.error(error), combined with Sentry'scaptureConsoleIntegrationto capture those as events:This is fragile and will break if vinext's internal code generation changes