Skip to content
oRPC
Esc
navigateopen⌘Jpreview
On this page

Timeout Plugin

Automatically abort requests that exceed a timeout with an AbortError, using a static value or a per-request dynamic timeout.

Usage

import { TimeoutLinkPlugin } from '@orpc/client/plugins'

const link = new RPCLink({
  plugins: [
    new TimeoutLinkPlugin({
      timeout: 10_000, // 10 seconds
    }),
  ],
})

Dynamic Timeout

The timeout option also accepts a function, so you can resolve the timeout per request from the interceptor options, such as the procedure path or the client context:

const link = new RPCLink({
  plugins: [
    new TimeoutLinkPlugin({
      timeout: ({ context, path }) => context.timeout ?? 10_000,
    }),
  ],
})

Learn More

For implementation details, see the source code.

Last updated on August 8, 2026

Was this page helpful?