is-vercel-timeout
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

is-vercel-timeout

Detecting when a serverless function has timed out on Vercel is usually straightforward, but some packages like TRPC insert their own error handling logic which can hide the original fetch error, making detection harder. This package exports functions suitable for detecting Vercel function timeouts in a variety of different contexts.

Usage

$ pnpm add is-vercel-timeout
import { isTRPCVercelTimeout } from 'is-vercel-timeout';

import { trpc } from '@/utils/trpc';

export default function IndexPage() {
  const { data, isLoading } = trpc.getSomeData.useQuery({}, {
    // Retry timeouts up to five times
    retry: (failureCount, err) => failureCount <= 5 && isTRPCVercelTimeout(err),
  });

  // ...
}

Readme

Keywords

Package Sidebar

Install

npm i is-vercel-timeout

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

5.5 kB

Total Files

6

Last publish

Collaborators

  • qqqry
  • sophiabits