You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
onError in renderRouterToStream destroys stream even for recoverable errors, breaking Error Boundary SSR rendering #7078
In renderRouterToStream.tsx, the onError callback added in #5996 destroys the PassThrough stream on any error, including errors that are caught by React Error Boundaries (recoverable errors).
React's renderToPipeableStream calls onError for all errors — both recoverable (caught by Error Boundary) and unrecoverable. When the error is recoverable:
Error Boundary catches the error and renders errorComponent / defaultErrorComponent
onShellReady fires normally — the shell includes the error fallback UI
onError also fires → stream.destroy() kills the already-piping stream
Response body becomes broken → upstream proxy returns 502 Bad Gateway
This means defaultErrorComponent and route-level errorComponent never render during SSR — users always see a 502 instead of the intended error page.
Your Example Website or App
N/A (reproducible in any TanStack Start app with defaultErrorComponent set)
onError: (error,info)=>{console.error('Error in renderToPipeableStream:',error,info)// Destroy the passthrough stream on errorif(!reactAppPassthrough.destroyed){reactAppPassthrough.destroy(errorinstanceofError ? error : newError(String(error)),)}},
onShellError(error){console.error('SSR Shell Error:',error)if(!reactAppPassthrough.destroyed)reactAppPassthrough.destroy(errorinstanceofError ? error : newError(String(error)),)},onError: (error,info)=>{console.error('Error in renderToPipeableStream:',error,info)},
onError: logging/flag-setting only, no stream.destroy().
This aligns with React's recommended pattern
where onError is used solely for logging — none of React's official
examples destroy the stream in onError.
onShellError (new): handle unrecoverable shell errors with fallback HTML,
as documented in React's API reference.
Activity