Skip to content

fastifyResilience

fastifyResilience(instance, options, done): void

Defined in: src/fastify.ts:31

Fastify plugin: request timeout with deadline propagation, load shedding, per-key rate limit with RateLimit-* headers, client-disconnect cancellation; resilience errors become 504/503/429/409/403 JSON (+ Retry-After). Applies to the instance it is registered on (it skips encapsulation, like fastify-plugin). Register it before your routes and await it, so its onRoute hook sees them: await app.register(fastifyResilience, { timeout: '5s', rateLimit: { key: (req) => req.ip, permitLimit: 100, window: '1m' } })

FastifyInstanceLike

InboundOptions

(error?) => void

void