Skip to content

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