# Trigger.dev webhooks in production: duplicates, retries and timeouts

Agent skill: `npx skills add hookdeck/webhook-skills --skill trigger-dev-webhooks` ([details](https://hookdeck.com/webhooks/trigger-dev/skill))

This guide covers the problems Trigger.dev alert webhooks cause in production and how to handle each one. What Trigger.dev sends is on the [Trigger.dev webhooks](/webhooks/trigger-dev) overview, the alert types are on [Trigger.dev webhook events](/webhooks/trigger-dev/events), and signature verification code is on [Verify Trigger.dev webhooks](/webhooks/trigger-dev/verify).

These are the alerts Trigger.dev sends to you. To receive other services' webhooks in your tasks, see Trigger.dev's [Webhooks docs](https://trigger.dev/docs/webhooks/overview), a separate feature in public beta. Its alerts docs state no timeout or retry policy, so the delivery figures below come from Trigger.dev's open source code and could change without the docs showing it.

## At a glance

| Problem | What to do | With Event Gateway |
| --- | --- | --- |
| [Timeouts](#timeouts) | Return a 2xx within 5 seconds; do the work in a background job | Accepts the alert at once, then queues it for your service |
| [Duplicates](#duplicates) | Deduplicate on `id`, or on the error group fields for `alert.error` | Can drop repeats before they reach your handler |
| [Retries](#retries) | Keep a second alert channel; list failed runs after an outage | Accepts alerts while your service is down and replays them |
| [Choosing events](#choosing-events) | Use run fails and error group alerts together; route on environment | Filters and routes on any field in the body |
| [Testing](#testing) | Fail a real run through a public URL; there's no test send | Forwards to localhost and replays past events |
| [Other limits](#other-limits) | Keep the SDK current; handle unknown types and varied versions | Stores every delivery, whatever its `type` |

## Trigger.dev webhook timeouts and slow handlers {#timeouts}

Return a 2xx within 5 seconds, then do the work in a background job.

**Why it happens:** Trigger.dev's docs don't state a timeout. Its [delivery code](https://github.com/triggerdotdev/trigger.dev/blob/main/apps/webapp/app/v3/services/alerts/alertTransport.server.ts) aborts each request after 5 seconds and treats any non-2xx response as a failure. A handler that opens a ticket, posts to chat or looks up the run before responding can run past that, and the failed attempt uses up one of only 3.

**Fix it in your handler:**

1. Verify the signature, store the alert and return 200.
2. Create tickets and send messages from a worker. See [why to process webhooks asynchronously](/webhooks/guides/why-implement-asynchronous-processing-webhooks).
3. Keep calls to other services out of the request path.

**With Event Gateway:** Hookdeck accepts each Trigger.dev alert immediately, then queues it and delivers it to your service with its own retries. Your handler can take as long as it needs without failing an alert.

## Duplicate Trigger.dev webhooks {#duplicates}

A delivery that times out is sent again, so the same alert can arrive twice. Deduplicate on `id` for run and deployment alerts, and on the error group's own fields for `alert.error`.

**Why it happens:** Trigger.dev's docs don't mention duplicates, but its code retries any attempt that fails or times out, even if your handler finished the work. Run and deployment alerts reuse the stored alert's ID as `id`, so a retry has the same `id`. `alert.error` [builds its payload](https://github.com/triggerdotdev/trigger.dev/blob/main/apps/webapp/app/v3/services/alerts/errorGroupWebhook.server.ts) on each attempt with a new random `id`, so a retried error group alert looks like a new event.

**Fix it in your handler:**

1. Store each `id` with a unique constraint before you open a ticket or page someone. See our [guide to webhook idempotency](/webhooks/guides/implement-webhook-idempotency).
2. For `alert.error`, build the key from `object.error.fingerprint`, `object.classification` and `object.error.lastSeen`. Those come from the alert's job, so they stay the same across attempts.
3. Skip anything you've seen, and still return a 2xx so Trigger.dev stops retrying.

**With Event Gateway:** [Deduplication](/docs/deduplication) can compare the fields you choose and drop repeats within a time window before they reach your handler.

## Trigger.dev webhook retries {#retries}

Trigger.dev makes up to 3 attempts, a few seconds apart, then stops. A short outage can lose an alert, so don't rely on a webhook alone for the alerts that matter most.

**Why it happens:** Trigger.dev's docs state no retry policy. Its [worker config](https://github.com/triggerdotdev/trigger.dev/blob/main/apps/webapp/app/v3/alertsWorker.server.ts) gives each delivery 3 attempts with a backoff that starts at about a second. Its delivery code treats `401`, `403`, `404` and `410` as permanent, so those aren't retried at all. Trigger.dev documents no resend, so an alert that runs out of attempts is gone.

**Fix it in your handler:**

1. Check that routes, auth proxies and deploys can't answer alerts with `401`, `403`, `404` or `410`, because one such response loses the alert.
2. Return a `5xx` when a dependency is down, which gets the remaining attempts.
3. Keep email or Slack alerts on for the alerts that matter most.
4. After an outage, list failed runs with the [runs API](https://trigger.dev/docs/management/runs/list) and check the Errors page.

**With Event Gateway:** Hookdeck accepts alerts while your service is down and delivers them with [automatic retries](/docs/retries) when it recovers, with [issue notifications](/docs/issues) when delivery fails. Trigger.dev gets its 2xx on the first attempt.

## Choosing Trigger.dev alert types {#choosing-events}

Use a run fails alert to hear about every failed run, and an error group alert to hear when something new breaks. Trigger.dev's docs say many teams want both.

**Why it happens:** An error group alert fires only when a group's status changes: a new issue, a regression after it was resolved, or a breach of an ignore condition. After it fires, the group is Unresolved and stays silent however many more times the error occurs. Trigger.dev documents this as intended, so a task can fail for days with no alert if an error group alert is the only one you have.

**Fix it in your handler:**

1. Create a run fails alert from the Alerts page. It fires for every run that fails once its retries are exhausted.
2. Create an error group alert from **Configure alerts...** on the Errors page. It then appears in the same Alerts table.
3. Resolve or ignore groups you've dealt with, so a recurrence alerts again.
4. Route on `type`, then on `object.environment.type` for run and deployment alerts. `alert.error` has only the environment's `id` and `name`, so match on `name` there.

**With Event Gateway:** Send every alert type to one Hookdeck source and use [filters](/docs/filters) on `type` and `object.environment.type` to route run failures, error groups and deployment results to different destinations.

## Testing Trigger.dev webhooks {#testing}

Trigger.dev documents no test send for alert webhooks, so make a real alert fire and send it to a public URL.

**Why you need a plan:** Its code refuses to deliver to private and loopback addresses, so a localhost URL won't work, and the docs publish no example body to build fixtures from. The docs list environment types as `PRODUCTION`, `STAGING` and `PREVIEW`, so test from a deployed environment rather than `trigger dev`.

**Test it safely:**

1. Create a webhook alert for a staging or preview environment, pointing at a public URL.
2. Deploy a task that throws, with its retries turned off so the run fails quickly. A deploy also fires the deployment alerts.
3. Save the bodies you receive as fixtures, including `webhookVersion`, and check your handler against them.

**With Event Gateway:** The [Hookdeck CLI](/docs/cli) receives webhooks on your machine without a public server, and you can replay past alerts to your handler as you change it.

## Other Trigger.dev webhook limits {#other-limits}

The SDK accepts only the alert types it knows, and only the body is signed.

* **Unknown types fail in the SDK.** [`webhooks.constructEvent`](https://github.com/triggerdotdev/trigger.dev/blob/main/packages/trigger-sdk/src/v3/webhooks.ts) checks the body against a fixed list of types and throws `WebhookError` on anything else, so the `default` branch in the docs' example can't run. Trigger.dev's code [already sends `alert.raised`](https://github.com/triggerdotdev/trigger.dev/blob/main/apps/webapp/app/v3/services/alerts/delivery/deliverAlertEvent.server.ts) for monitoring alerts, including its private beta Limits alerts, and that type isn't in the list or the docs.
* **Versions differ by type.** The docs show no `webhookVersion` value. The code sends `v1` on run and deployment alerts and `2025-01-01` on `alert.error`, so don't check for a single value.
* **No replay protection.** Only the body is signed, with no timestamp, so a captured request stays valid.
* **No published IP list.** You can't allowlist Trigger.dev's addresses from its docs. Rely on the signature.
* **Alerts only.** No webhook fires when a run starts or succeeds.

**Fix it in your handler:**

1. Keep `@trigger.dev/sdk` current, or verify by hand as shown on the [Verify](/webhooks/trigger-dev/verify) page if you need to accept types the SDK doesn't list.
2. Log and acknowledge any `type` you don't handle.
3. Deduplicate, which also stops a replayed request from acting twice.

**With Event Gateway:** Hookdeck verifies the signature and stores every delivery, whatever its `type`, so a new alert type shows up in your logs before you handle it.