Overview
When a webhook delivery fails, Cuey implements a robust retry mechanism to ensure reliable delivery. This page explains how Cuey handles failures and retries.Delivery Failure
A webhook delivery is considered failed when:- The HTTP request times out
- The server returns a non-2xx status code (e.g., 4xx, 5xx)
- A network error occurs (connection refused, DNS failure, etc.)
- The server doesn’t respond within the timeout period
Retry Mechanism
Retry Configuration
You can configure retry behavior when creating an event or cron job:Configuration for retry behavior.
Retry Process
When a webhook delivery fails:- Original event: Immediately marked as Failed
- Retry events: If retries are configured, Cuey creates new events for each retry attempt
- Retry event properties:
- Status: Processing (until execution completes)
retry_of: Set to the ID of the original failed event- Scheduled time: Based on backoff delay from the original failure time
- Billing: Each retry event is billed as a separate event
Retry Event Creation
For each retry, a new event is created with:- The same webhook URL, payload, and headers as the original event
retry_offield set to the original event’s IDscheduled_atset based on the backoff delay- Status initially set to Processing
Retry Timing Example
For a retry configuration withmaxRetries: 3, backoffMs: 1000, and backoffType: "exponential":
- Original event: Fails immediately → Status: Failed
- Retry event 1: Created and scheduled 1 second later (1000ms backoff)
- Retry event 2: Created and scheduled 2 seconds after retry 1 (2000ms backoff)
- Retry event 3: Created and scheduled 4 seconds after retry 2 (4000ms backoff)
backoffType: "linear" with the same configuration:
- Original event: Fails immediately → Status: Failed
- Retry event 1: Created and scheduled 1 second later (1000ms backoff)
- Retry event 2: Created and scheduled 1 second after retry 1 (1000ms backoff)
- Retry event 3: Created and scheduled 1 second after retry 2 (1000ms backoff)
Tracking Retries
You can identify retry events by checking theretry_of field, which contains the ID of the original failed event. This allows you to:
- Track all retry attempts for a specific original event
- See the complete retry history by querying events with a specific
retry_ofvalue - Understand the relationship between the original event and its retries
Success After Retry
If any retry event succeeds (receives a 2xx status code), it transitions to Success status. No further retry events are created after a successful retry.Monitoring Failed Events and Retries
You can monitor failed events and their retries by:- Filtering events by status: List all events with
status: "failed"to see original failures - Finding retry events: Query events with a specific
retry_ofvalue to see all retry attempts for an original event - Checking event details: Retrieve a specific event to see its execution results, including:
- Response status codes
- Response headers and body (truncated to 1KB)
- Response duration
- Error messages if the attempt failed
- Understanding retry relationships: Use the
retry_offield to trace retry events back to their original failed event
Best Practices
Configure Appropriate Retries
- Use exponential backoff for transient failures (server overload, temporary network issues)
- Use linear backoff for consistent retry intervals
- Set
maxRetriesbased on your tolerance for delayed delivery vs. giving up
Handle Different Failure Types
- 4xx errors (client errors): Usually indicate invalid requests—retries may not help unless you fix the request
- 5xx errors (server errors): Often transient—retries are more likely to succeed
- Timeouts: May indicate server overload—exponential backoff is recommended
Monitor and Alert
Set up monitoring for failed events and configure alerts to notify you when failures occur, especially for critical webhooks.Related Resources
Building Blocks
Understand events and crons.
Retry Configuration
Learn more about configuring retries.
TypeScript SDK
Get started with the TypeScript SDK.
REST API
Explore the REST API documentation.