inngest-durable-functions

Use when building functions that must survive process crashes, retry automatically on failure, run on a schedule, react to events, or maintain state across infrastructure failures — e.g., webhook handlers that drop events, flaky cron jobs, background jobs that fail mid-execution, or workflows that n

By inngest · 3,472 installs

npx skills add inngest/inngest-skills --skill inngest-durable-functions

Source repository · Upstream listing

Inngest Durable Functions Master Inngest's durable execution model for building fault tolerant, long running workflows. This skill covers the complete lifecycle from triggers to error handling. These skills are focused on TypeScript. For Python or Go, refer to the [Inngest documentation](https://www.inngest.com/llms.txt) for language specific guidance. Core concepts apply across all languages. Core Concepts You Need to Know Durable Execution Model Each step should encapsulate side effects and non deterministic code Memoization prevents re execution of completed steps State persistence survives infrastructure failures Automatic retries with configurable retry count Step Execution Flow Function Limits Every Inngest function has these hard limits: Maximum 1,000 steps per function run Maximum 4MB returned data for each step Maximum 32MB combined function run state including, event data, step output, and function output Each step = separate HTTP request (~50 100ms overhead) If you're hitting these limits, break your function into smaller functions connected via step.invoke() or step.sendEvent() . When to Use Steps Always wrap in step.run() : API calls and network requests Database reads and writes File I/O operations Any non deterministic operation Anything you want retried independently on failure Never wrap in step.run() : Pure calculations and data transformations Simple validation logic Deterministic operations with no side effects Logging (use outside steps) Function Creation Basic Function Structure Step IDs and Memoization Triggers and Events Event Triggers Triggers are defined in the triggers array in the first argument of createFunction : Cron Triggers Function Invocation Idempotency Strategies Event Level Idempotency (Producer Side) Function Level Idempotency (Consumer Side) Cancellation Patterns Event Based Cancellation In expressions, event = the original triggering event, async = the new event being matched. See [Expression Syntax Reference](../references/expressions.md) for full details. Timeout Cancellation Handling Cancellation Cleanup Error Handling and Retries Default Retry Behavior 5 total attempts (1 initial + 4 retries) per step Exponential backoff with jitter Independent retry counters per step Custom Retry Configuration Non Retriable Errors Prevent retries for code that won't succeed upon retry. Custom Retry Timing Logging Best Practices Proper Logging Setup ⚠️ v4 Breaking Change: The logLevel option has been removed. Use the logger option with ConsoleLogger or a custom logger instead. Function Logging Patterns Performance Optimization Checkpointing Checkpointing is enabled by default in v4 . It allows functions to persist state periodically during execution, reducing latency between steps. Advanced Patterns Conditional Step Execution Error Recovery Patterns Common Mistakes to Avoid 1. ❌ Non deterministic code outside steps 2. ❌ Database calls outside steps 3. ❌ Logging outside steps (causes duplicates) 4. ❌ Changing step IDs after deployment 5. ❌ Not handling NonRetriableError cases 6. ❌ Ignoring idempotency for critical functions Next Steps See inngest steps for detailed step method reference See [references/step execution.md](references/step execution.md) for detailed step patterns See [references/error handling.md](references/error handling.md) for comprehensive error strategies See [references/observability.md](references/observability.md) for monitoring and tracing setup See [references/checkpointing.md](references/checkpointing.md) for performance optimization details This skill covers Inngest's durable function patterns. For event sending and webhook handling, see the inngest events skill.