Trigger.dev webhooks in production: duplicates, retries and timeouts
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 overview, the alert types are on Trigger.dev webhook events, and signature verification code is on Verify Trigger.dev webhooks.
These are the alerts Trigger.dev sends to you. To receive other services' webhooks in your tasks, see Trigger.dev's Webhooks docs, 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 | 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 | Deduplicate on id, or on the error group fields for alert.error | Can drop repeats before they reach your handler |
| Retries | Keep a second alert channel; list failed runs after an outage | Accepts alerts while your service is down and replays them |
| Choosing events | Use run fails and error group alerts together; route on environment | Filters and routes on any field in the body |
| Testing | Fail a real run through a public URL; there's no test send | Forwards to localhost and replays past events |
| 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
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 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:
- Verify the signature, store the alert and return 200.
- Create tickets and send messages from a worker. See why to process webhooks asynchronously.
- 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
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 on each attempt with a new random id, so a retried error group alert looks like a new event.
Fix it in your handler:
- Store each
idwith a unique constraint before you open a ticket or page someone. See our guide to webhook idempotency. - For
alert.error, build the key fromobject.error.fingerprint,object.classificationandobject.error.lastSeen. Those come from the alert's job, so they stay the same across attempts. - Skip anything you've seen, and still return a 2xx so Trigger.dev stops retrying.
With Event Gateway: Deduplication can compare the fields you choose and drop repeats within a time window before they reach your handler.
Trigger.dev webhook 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 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:
- Check that routes, auth proxies and deploys can't answer alerts with
401,403,404or410, because one such response loses the alert. - Return a
5xxwhen a dependency is down, which gets the remaining attempts. - Keep email or Slack alerts on for the alerts that matter most.
- After an outage, list failed runs with the runs API and check the Errors page.
With Event Gateway: Hookdeck accepts alerts while your service is down and delivers them with automatic retries when it recovers, with issue notifications when delivery fails. Trigger.dev gets its 2xx on the first attempt.
Choosing Trigger.dev alert types
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:
- Create a run fails alert from the Alerts page. It fires for every run that fails once its retries are exhausted.
- Create an error group alert from Configure alerts... on the Errors page. It then appears in the same Alerts table.
- Resolve or ignore groups you've dealt with, so a recurrence alerts again.
- Route on
type, then onobject.environment.typefor run and deployment alerts.alert.errorhas only the environment'sidandname, so match onnamethere.
With Event Gateway: Send every alert type to one Hookdeck source and use filters on type and object.environment.type to route run failures, error groups and deployment results to different destinations.
Testing Trigger.dev webhooks
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:
- Create a webhook alert for a staging or preview environment, pointing at a public URL.
- Deploy a task that throws, with its retries turned off so the run fails quickly. A deploy also fires the deployment alerts.
- Save the bodies you receive as fixtures, including
webhookVersion, and check your handler against them.
With Event Gateway: The Hookdeck 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
The SDK accepts only the alert types it knows, and only the body is signed.
- Unknown types fail in the SDK.
webhooks.constructEventchecks the body against a fixed list of types and throwsWebhookErroron anything else, so thedefaultbranch in the docs' example can't run. Trigger.dev's code already sendsalert.raisedfor 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
webhookVersionvalue. The code sendsv1on run and deployment alerts and2025-01-01onalert.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:
- Keep
@trigger.dev/sdkcurrent, or verify by hand as shown on the Verify page if you need to accept types the SDK doesn't list. - Log and acknowledge any
typeyou don't handle. - 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.
Keep a short outage from losing your Trigger.dev alerts.
Hookdeck Event Gateway verifies the signature and accepts each alert as soon as it arrives, then queues it and retries to your service on your schedule.