property ProcessOptions.onFailed
Since 0.3.0

Invoked once when a job has exhausted its attempts, immediately before it is dead-lettered — the only programmatic notice that work was permanently abandoned. It does NOT fire on an attempt that will be retried.

Without it a dead-lettered job is reachable only by opening a Redis client: IQueue has no getJob and no dead-letter accessor, and the adapters' dead-letter structures are internal.

A callback that throws is reported through the application's logger and swallowed; the dead-letter still happens, because losing the job as well as the notification would be strictly worse than losing the notification.

Type

(
job: IJob,
error: unknown
) => void | Promise<void>

Usage

import { type ProcessOptions } from "common/src/index.ts";