Tip
v2 is close to stable. Tell us what hurt when migrating and what should change before stable: #2446
Highlights
This beta is mostly fixes: several close security gaps in the NestJS integration, the client cookie jar, GET batching, and static file serving. Two breaking changes affect custom tracing backends and code that relied on wrapped iterators keeping their identity.
// A custom tracing backend now receives the value exactly as it was thrown
const span: TracingSpan = {
recordException(level, error) {
// `error` keeps its cause chain, custom properties, and `instanceof ORPCError`
},
// ...
}
// Routers accept missing entries again
const router: { ping: typeof ping, debug?: typeof debug } = {
ping,
debug: isDev ? debug : undefined,
}- Breaking — tracing exceptions:
TracingSpan.recordExceptionreceives the original thrown value instead of a normalizedTracingException, so backends see the cause chain, custom properties, and error identity.toTracingExceptionandTracingExceptionare no longer exported from@orpc/shared. OpenTelemetry · Cloudflare Traces - Breaking — iterator and stream identity: iterators and streams that pass through validation, tracing, logging, retry, or the timeout plugin no longer keep custom properties or their original class. Hibernation no longer depends on it: the plugin captures the iterator at the handler, so a plugin or middleware that wraps iterators can't silently break it. With the plugin installed,
options.procedureis a copy of the procedure. Hibernation - NestJS guards: guards, interceptors, and
@SetMetadataplaced above a method-replacing decorator such as@Span()or@Transactional()now apply to router-based@Implementroutes. Requests that were wrongly allowed now get403. Docs - Client security: a GET batch no longer writes per-request headers such as
authorizationinto the URL, and the cookie jar rejects nameless cookies that pass for__Secure-or__Host-cookies. Batch · Cookies - WebSocket reconnect: the attempt counter resets only after a connection receives a message or stays open for 5 seconds, so a server that accepts and closes right away gets the backoff and counts toward
maxAttempt. Docs - Static files: a file that grows while it is being served can no longer send more bytes than its
content-length, which could corrupt the next response on the connection. Docs - Optional router entries:
nullandundefinedentries in a router or contract are skipped instead of crashing handlers, generators,implement(), and@Implement()at startup. - Compressed requests: a compressed binary body from a plain client now decodes to the same
Fileas the uncompressed one.
🚨 Breaking Changes
- Stop preserving iterator and stream identity with
override- by @dinwwwh in #2496 (33f07) - shared, server, opentelemetry, cloudflare: Pass the original error to
TracingSpan.recordException- by @dinwwwh in #2494 (a7644)
🐞 Bug Fixes
- client:
- nest:
- node:
- openapi-inference:
- server:
- server, nest: