Skip to content

Releases

v2.0.0-beta.53

v2.0.0-beta.53 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 23 Nov 12:31

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’s condition to shouldRetry. For WebSocket reconnects, rename maxAttempt, maxTotalAttempt, and the callback field totalAttempt to maxAttempts, maxTotalAttempts, and totalAttempts. RetryLinkPlugin’s retry: 3 still allows three retries after the first request. #2525
  • Breaking — error types. ORPCError.code and ORPCError.data are now readonly in TypeScript. Timeout plugins use TimeoutError, and WebSocket and MessagePort links reject with ConnectionClosedError when the connection closes. Update any handlers that previously caught these cases as AbortError. #2523 · #2533
  • Breaking — locks and Redis publishers. Pass an explicit ttl in milliseconds to MemoryLocker. If you subclass BaseRedisPublisher, rename eventPrefix to keyPrefix and remove references to xTrimExactness, 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 error option. The client receives a defined error when its code and data match the procedure’s error contract. The temporary-upload plugin also now requires maxBodySize. #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-reset now 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:
    • Expire MemoryLocker locks whose request ended on Cloudflare Workers  -  by @dinwwwh in #2540 (ab831)
  • 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

Choose a tag to compare

@github-actions github-actions released this 23 Nov 02:21

   🐞 Bug Fixes

  • server, openapi: Stop sharing lazy router loads across requests  -  by @dinwwwh in #2536 (71f3b)
    View changes on GitHub

v2.0.0-beta.52

v2.0.0-beta.52 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 19 Nov 13:44

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.recordException receives the original thrown value instead of a normalized TracingException, so backends see the cause chain, custom properties, and error identity. toTracingException and TracingException are 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.procedure is a copy of the procedure. Hibernation
  • NestJS guards: guards, interceptors, and @SetMetadata placed above a method-replacing decorator such as @Span() or @Transactional() now apply to router-based @Implement routes. Requests that were wrongly allowed now get 403. Docs
  • Client security: a GET batch no longer writes per-request headers such as authorization into 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: null and undefined entries 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 File as 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

    View changes on GitHub

v1.16.4

Choose a tag to compare

@github-actions github-actions released this 19 Nov 10:44

   🐞 Bug Fixes

  • nest: Keep guards and metadata on router-based @Implement routes  -  by @dinwwwh in #2498 (7b122)
    View changes on GitHub

v1.16.3

Choose a tag to compare

@github-actions github-actions released this 18 Nov 08:00

   🐞 Bug Fixes

    View changes on GitHub

v2.0.0-beta.51

v2.0.0-beta.51 Pre-release
Pre-release

Choose a tag to compare

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-inference documents procedures without .output and 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 createToolFactory no 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 of undefined, so .optional() and .default() no longer see a missing value. The spec marks these parameters required only when the schema rejects the empty collection. Docs
  • OpenAPI spec changes: a body whose files may be absent also lists application/json, and a GET input that is a record of primitive values becomes one free-form query parameter. 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:
    • Infer unknown instead of ThrowableError when next has no typed error  -  by @dinwwwh in #2464 (1df6f)

   🏎 Performance

  • client, tanstack-query, swr, pinia-colada, effect, openapi:
  • contract, server:
  • contract, server, openapi, msw:
  • effect:
  • server:
  • server, shared:
  • shared:
  • shared, server, next:
    • Make procedure handlers cheaper to type-check (−12% to −25% instantiations)  -  by @dinwwwh in #2457 (16fc7)
  • tanstack-query:
    View changes on GitHub

v2.0.0-beta.50

v2.0.0-beta.50 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 09 Nov 10:05

Packages are now built with tsdown

    View changes on GitHub

v2.0.0-beta.49

v2.0.0-beta.49 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 07 Nov 09:36

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, WebSocket reconnect, event stream initialComment/keepAlive, and batch keepAlive take true, false, or an object instead of { enabled }. Publisher · WebSocket · Event Stream · Batch
  • Breaking — propagation: propagationEnabled is now propagation and accepts { inject, extract }. OpenTelemetry · Cloudflare
  • Breaking — streamed queries: refetches keep existing data until the new stream connects, refetchMode: 'replace' is removed, and the new settleOnFirstData lets SSR finish at the first data. TanStack Query · Pinia Colada · SWR · Migration
  • Breaking — static files: allowSymlinks is removed, .. paths are refused, and directories no longer redirect. Docs
  • Breaking — OpenAPI component names: ids are sanitized to valid keys (User Profile → User_Profile), and componentName must return a string. Docs
  • Redirects: fetch links now follow redirects. Use a custom fetch with redirect: 'manual' to get 3xx responses. Docs
  • Other breaking changes: omitUndefinedProperties removed from the OpenAPI serializer (#2441), outputStatus must return a number (#2438), and a few @standard-server exports renamed (#2430).

   🚨 Breaking Changes

   🐞 Bug Fixes

  • client:
  • client, openapi:
  • contract:
    • Reconcile mid-stream errors in response validation plugin  -  by @dinwwwh in #2380 (4bdb6)
    • Keep own __proto__ routes in augmentContractRouter and minifyRouterContract  -  by @dinwwwh and Claude in #2401 (4d691)
  • hibernation:
  • json-schema, openapi:
  • lock:
  • next:
  • openapi:
  • openapi, json-schema, zod:
  • opentelemetry:
    • Simplify package and keep context so baggage propagates  -  by @dinwwwh and Claude in #2408 (2edd7)
  • pinia-colada,tanstack-query,swr:
  • publisher:
  • rpc:
  • rpc,openapi:
    • Run custom primitive handlers on the inlined JSON serializer fast path  -  by @dinwwwh in #2381 (989bd)
  • server:
    • Ignore websocket messages received after close  -  by @dinwwwh in #2373 (73a9f)
    • Serve the implementation when a normal router is implemented as a contract  -  by @dinwwwh and Claude in #2378 (f59a9)
    • Ignore message-port messages after close ...
Read more

v1.16.2

Choose a tag to compare

@github-actions github-actions released this 06 Nov 08:11

   🐞 Bug Fixes

    View changes on GitHub

v2.0.0-beta.48

v2.0.0-beta.48 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 01 Nov 13:51

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: CookieJarLinkPlugin stores cookies servers set and sends them back, like a browser. Docs
  • HEAD method: HeadMethodHandlerPlugin answers HEAD with the matching GET procedure, without the body. Docs
  • Batch response modes: buffered (default) keeps headers and cookies; streaming sends 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 null or undefined from errorResponseBodyEncoder, errorResponseBodyDecoder, or errorResponseBodySchema no longer falls back to the default. Call error.toJSON(), defaultError(), or defaultSchema() instead. Handler · Link

   🚨 Breaking Changes

   🚀 Features

   🐞 Bug Fixes

    View changes on GitHub