Skip to content

Fix silent error absorption in RSC payload injection#2486

Merged
AbanoubGhadban merged 6 commits into2402-streaming-hang-on-errorfrom
abanoub/2450-inject-rsc-payload-error-logging
Feb 27, 2026
Merged

Fix silent error absorption in RSC payload injection#2486
AbanoubGhadban merged 6 commits into2402-streaming-hang-on-errorfrom
abanoub/2450-inject-rsc-payload-error-logging

Conversation

@AbanoubGhadban
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes silent error absorption in injectRSCPayload.ts where three error handlers (htmlStream.on('error', () => {}), catch {} in startRSC, and .catch(() => endResultStream())) swallowed errors, preventing them from reaching errorReporter/Sentry
  • Introduces a shared safePipe utility that replaces the scattered pipe+close boilerplate with a single function handling the Node.js pipe() gap (destination not ended on source destroy) and optional onError callback for non-fatal error reporting
  • Fixes a missed pipe site in transformRSCNodeStream.ts that PR Fix streaming SSR hangs and silent error absorption in RSC payload injection #2407 did not cover

How it works

Errors emitted on resultStream inside injectRSCPayload propagate through safePipe's onError at the pipeToTransform site → emitError()readableStreamhandleStreamErrorerrorReporter. The pipe stays intact, data continues flowing, and Fastify never sees the errors.

Test plan

  • injectRSCPayload.test.ts — 7 tests pass
  • streamServerRenderedReactComponent.test.jsx — 16 tests pass
  • RSCRequestTracker.test.ts — 8 tests pass
  • streamBackpressure.e2e.test.tsx — 4 tests pass
  • handleStreamError.test.ts — 6 tests pass
  • streamErrorHang.test.ts — 3 tests pass
  • ESLint passes with 0 errors
  • Prettier formatting clean
  • TypeScript compilation clean

Closes #2450

🤖 Generated with Claude Code

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant