Repository navigation
Releases
v2.0.0-beta.53
Tip
oRPC v2 is close to stable. If you’ve tried the beta, tell us what was hard to migrate, which changes surprised you, and what you still need before upgrading. Join the v2 discussion.
Highlights
This beta tightens the retry, error, and lock APIs ahead of v2 stable. It also lets you customize errors from built-in request guards and fixes intermittent lazy-router failures on Cloudflare Workers.
const retryAfter = new RetryAfterLinkPlugin({
shouldRetry: (response) => [429, 503].includes(response.status),
maxAttempts: 3, // Includes the first request
})- Breaking — retry and reconnect options. Rename
RetryAfterLinkPlugin’sconditiontoshouldRetry. For WebSocket reconnects, renamemaxAttempt,maxTotalAttempt, and the callback fieldtotalAttempttomaxAttempts,maxTotalAttempts, andtotalAttempts.RetryLinkPlugin’sretry: 3still allows three retries after the first request. #2525 - Breaking — error types.
ORPCError.codeandORPCError.dataare now readonly in TypeScript. Timeout plugins useTimeoutError, and WebSocket and MessagePort links reject withConnectionClosedErrorwhen the connection closes. Update any handlers that previously caught these cases asAbortError. #2523 · #2533 - Breaking — locks and Redis publishers. Pass an explicit
ttlin milliseconds toMemoryLocker. If you subclassBaseRedisPublisher, renameeventPrefixtokeyPrefixand remove references toxTrimExactness, which is now private. #2529 - Custom request refusal errors. The rate-limit and lock middleware, request-size and temporary-upload plugins, and GET CSRF protection accept an
erroroption. The client receives a defined error when its code and data match the procedure’s error contract. The temporary-upload plugin also now requiresmaxBodySize. #2514 · #2529 · #2543 - Cloudflare Workers. RPC, OpenAPI, and MCP handlers no longer share in-flight lazy-router loads across requests, so one request ending during a load can no longer stall later requests. Memory locks held by ended requests can also expire. #2535 · #2540
- Rate-limit headers and tRPC inputs.
ratelimit-resetnow reports seconds, and the tRPC adapter carries every chained input schema into the converted oRPC procedure. #2530 · #2542
🚨 Breaking Changes
- client: Unify retry and attempt option naming - by @dinwwwh in #2525 (f262f)
- client, contract, json-schema: Make ORPCError code and data readonly and fix the name brand - by @dinwwwh in #2523 (b5920)
- publisher, lock, bun: Align the Redis extension surface and lock options - by @dinwwwh in #2529 (742cd)
🚀 Features
- server, ratelimit, node: Allow custom errors for built-in request refusals - by @dinwwwh in #2514 (77da9)
🐞 Bug Fixes
- client:
- client, server, shared:
- lock:
- nest:
- node:
- ratelimit:
- server:
- Convert decode failures to BAD_REQUEST before interceptors see them - by @dinwwwh in #2517 (2d3fe)
- Align matched in WebSocket and crossws message() with MessagePort - by @dinwwwh in #2532 (7b0fd)
- Default method override param to _method and keep the query string intact - by @dinwwwh in #2541 (0027e)
- server, openapi, mcp:
- trpc:
View changes on GitHub
v1.16.5
🐞 Bug Fixes
View changes on GitHub
v2.0.0-beta.52
Tip
v2 is close to stable. Tell us what hurt when migrating and what should change before stable: https://github.com/middleapi/orpc/discussions/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:
View changes on GitHub
v1.16.4
🐞 Bug Fixes
View changes on GitHub
v1.16.3
🐞 Bug Fixes
View changes on GitHub
v2.0.0-beta.51
Tip
v2 is close to stable. Tell us what hurt when migrating and what should change before stable: https://github.com/middleapi/orpc/discussions/2446
Highlights
This beta adds experimental OpenAPI schema inference from TypeScript types, and makes the server, contract, and client types cheaper to type-check. Two breaking changes affect AI SDK tool outputs and delimited query parameters.
import { OpenAPIGenerator } from '@orpc/experimental-openapi-inference'
// Drop-in for the generator in `@orpc/openapi`: converters still run first,
// and the rest is inferred from your TypeScript types
const generator = new OpenAPIGenerator({
converters: [new ZodToJsonSchemaConverter()],
})
const spec = await generator.generate(router, {
source: { file: './src/router.ts', export: 'router' },
})- OpenAPI type inference (experimental):
@orpc/experimental-openapi-inferencedocuments procedures without.outputand inputs written as plain types, using the TypeScript 7 compiler. Schemas match what the serializer sends, project types become named components, and JSDoc sets summaries, descriptions, and keywords like@format. Docs - Faster type-checking: builder chains,
.use(middleware), routers,RouterClient, and recursive client and router types are cheaper to check. Procedure handlers alone take 12% to 25% fewer instantiations. - Breaking — AI SDK tool outputs: tools from
createToolFactoryno longer validate or transform procedure outputs. They return what the handler returns, like plain AI SDK tools and the types already said. Docs - Breaking — delimited query styles: with
*-delimited-*styles, a missing or empty parameter now decodes as[]or{}instead ofundefined, so.optional()and.default()no longer see a missing value. The spec marks these parametersrequiredonly when the schema rejects the empty collection. Docs - OpenAPI spec changes: a body whose files may be absent also lists
application/json, and aGETinput that is a record of primitive values becomes one free-formqueryparameter. Docs
🚨 Breaking Changes
- ai-sdk: Disable output validation in
createToolFactory- by @dinwwwh in #2465 (67864) - openapi: Decode missing collection-style query parameters as empty collections - by @dinwwwh in #2462 (850fe)
🚀 Features
- openapi, openapi-inference: Infer OpenAPI schemas from TypeScript types - by @dinwwwh in #2479 (62b9b)
🐞 Bug Fixes
- Make options optional when context is an index-signature type - by @dinwwwh in #2472 (df5f5)
- client, tanstack-query, swr, pinia-colada, effect, openapi:
- contract:
- contract, server:
- server:
- shared:
🏎 Performance
- client, tanstack-query, swr, pinia-colada, effect, openapi:
- contract, server:
- contract, server, openapi, msw:
- effect:
- server:
- server, shared:
- shared:
- shared, server, next:
- tanstack-query:
View changes on GitHub
v2.0.0-beta.50
v2.0.0-beta.49
Highlights
This beta cleans up option shapes before v2 stable. Most breaking changes are renames your type checker will flag.
// Boolean-or-object options replace `{ enabled }`
new MemoryPublisher({ resume: { ttl: 60_000 } })
new RPCLink({ connect, reconnect: { maxAttempt: 5, onClose: true } })
new BatchHandlerPlugin({ keepAlive: false })
// Per-direction trace propagation
new ORPCInstrumentation({ propagation: { extract: false } })Tip
v2 is close to stable. Tell us what hurt when migrating and what should change before stable: https://github.com/middleapi/orpc/discussions/2446
- Breaking — boolean-or-object options: publisher
resume, WebSocketreconnect, event streaminitialComment/keepAlive, and batchkeepAlivetaketrue,false, or an object instead of{ enabled }. Publisher · WebSocket · Event Stream · Batch - Breaking — propagation:
propagationEnabledis nowpropagationand accepts{ inject, extract }. OpenTelemetry · Cloudflare - Breaking — streamed queries: refetches keep existing data until the new stream connects,
refetchMode: 'replace'is removed, and the newsettleOnFirstDatalets SSR finish at the first data. TanStack Query · Pinia Colada · SWR · Migration - Breaking — static files:
allowSymlinksis removed,..paths are refused, and directories no longer redirect. Docs - Breaking — OpenAPI component names: ids are sanitized to valid keys (
User Profile→User_Profile), andcomponentNamemust return a string. Docs - Redirects: fetch links now follow redirects. Use a custom
fetchwithredirect: 'manual'to get3xxresponses. Docs - Other breaking changes:
omitUndefinedPropertiesremoved from the OpenAPI serializer (#2441),outputStatusmust return a number (#2438), and a few@standard-serverexports renamed (#2430).
🚨 Breaking Changes
- Upgrade standard-server to 0.15.0 - by @dinwwwh in #2430 (ef9a0)
- client, publisher, cloudflare:
- node:
- openapi:
- opentelemetry, cloudflare:
- pinia-colada, tanstack-query, swr:
- rpc:
🐞 Bug Fixes
- client:
- client, openapi:
- contract:
- hibernation:
- json-schema, openapi:
- lock:
- next:
- openapi:
- openapi, json-schema, zod:
- opentelemetry:
- pinia-colada,tanstack-query,swr:
- publisher:
- rpc:
- rpc,openapi:
- server:
v1.16.2
🐞 Bug Fixes
View changes on GitHub
v2.0.0-beta.48
Highlights
This beta adds a cookie jar for clients outside the browser, HEAD support for GET procedures, a streaming option for batch responses, and a new OpenAPI router. One breaking change affects custom OpenAPI error responses.
import { BatchLinkPlugin, CookieJarLinkPlugin } from '@orpc/client/plugins'
import { HeadMethodHandlerPlugin } from '@orpc/server/plugins'
// Server: answer HEAD with the matching GET procedure's status and headers
const handler = new OpenAPIHandler(router, {
plugins: [new HeadMethodHandlerPlugin()],
})
// Client: keep cookies in SSR, scripts, and tests, and stream batch responses
const link = new RPCLink({
origin,
url: '/rpc',
plugins: [
new CookieJarLinkPlugin({ origin }),
new BatchLinkPlugin({
mode: 'streaming', // default: 'buffered'
groups: [{ condition: () => true, context: {} }],
}),
],
})- Cookie Jar:
CookieJarLinkPluginstores cookies servers set and sends them back, like a browser. Docs - HEAD method:
HeadMethodHandlerPluginanswersHEADwith the matchingGETprocedure, without the body. Docs - Batch response modes:
buffered(default) keeps headers and cookies;streamingsends each response as soon as it is ready. Docs - OpenAPI router: routing now uses
@openapi-spec/router, which matches OpenAPI path templates directly. Only edge cases change: overlapping routes rank literal > param > catch-all per segment, empty segments are kept, and the first duplicate route wins. Docs - Breaking: returning
nullorundefinedfromerrorResponseBodyEncoder,errorResponseBodyDecoder, orerrorResponseBodySchemano longer falls back to the default. Callerror.toJSON(),defaultError(), ordefaultSchema()instead. Handler · Link
🚨 Breaking Changes
🚀 Features
- client: Add CookieJarLinkPlugin - by @dinwwwh in #2366 (6567c)
- openapi: Upgrade openapi-spec to 0.6.0 and replace rou3 with its router - by @dinwwwh in #2370 (8e13d)
- rpc: Bring back batch response mode, buffered by default - by @dinwwwh in #2369 (c7ae6)
- server: Add HeadMethodHandlerPlugin - by @dinwwwh in #2353 (82a71)
🐞 Bug Fixes
- Upgrade standard-server to 0.14.0 - by @dinwwwh and Claude in #2371 (62711)
- openapi: Keep additionalProperties on bodies split from path params - by @dinwwwh in #2364 (b3a73)
- rpc: Skip unknown meta types when deserializing - by @dinwwwh in #2357 (344b3)