inngest-middleware

Implement Inngest middleware for logging, error tracking, encryption, and dependency injection.

Updated Feb 27, 2026
One-click install
npx skills add https://github.com/firstaxel/neon --skill inngest-middleware-firstaxel
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: inngest-middleware
Source: https://github.com/firstaxel/neon/tree/main/.agents/skills/inngest-middleware
Command: npx skills add https://github.com/firstaxel/neon --skill inngest-middleware-firstaxel

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires inngest, @inngest/middleware-encryption, @inngest/middleware-sentry, and includes references (resource) components.

What problem does it solve? Durable functions often need cross-cutting concerns like logging, error tracking, encryption, and shared clients applied uniformly, and writing this logic inside every function leads to duplication and inconsistency. ## Core Features & Use Cases - Custom Middleware Lifecycle: Build middleware with the v4 InngestMiddleware API using hooks like onFunctionRun, onSendEvent, transformInput, and transformOutput. - Dependency Injection: Inject shared clients such as databases, Stripe, or OpenAI into function handlers using the built-in dependencyInjectionMiddleware or custom patterns. - Official Middleware Packages: Apply @inngest/middleware-encryption for payload encryption with key rotation and @inngest/middleware-sentry for error tracking and tracing. - Use Case: You want every function run to report exceptions to Sentry with function ID and event name context, while encrypting sensitive step data and injecting a Prisma client into all handlers. ## Quick Start Add Sentry error tracking and dependency injection middleware to my Inngest client so all functions share a database client and report errors automatically.

Frequently Asked Questions about inngest-middleware

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add middleware to Inngest functions?▼

Register middleware on the Inngest client via the middleware array to affect all functions, or on individual functions via createFunction options. Client middleware runs first, followed by function-level middleware in the order specified.

How do I inject dependencies into Inngest function handlers?▼

Use the built-in dependencyInjectionMiddleware from the inngest package, passing an object of clients like databases or OpenAI. Injected dependencies then appear directly in the function handler context alongside event and step.

Does Inngest middleware support Sentry error tracking?▼

Yes, install @inngest/middleware-sentry and add sentryMiddleware() to your client middleware after initializing Sentry. It captures exceptions, adds tracing per function run, and requires @sentry/* version 8.0.0 or higher.

How do I encrypt sensitive data in Inngest functions?▼

Install @inngest/middleware-encryption and configure encryptionMiddleware with an encryption key. It encrypts step data, function output, and the event data.encrypted field, with fallbackDecryptionKeys supporting key rotation.

Why does @inngest/realtime fail with Inngest v4?▼

The @inngest/realtime package is a v3-era library that throws TypeError: Cls is not a constructor on v4 projects. Inngest v4 ships realtime natively via step.realtime.publish, so no realtime middleware is needed.

What changed in Inngest middleware between v3 and v4?▼

The middleware system was significantly rewritten in v4 with a new lifecycle hook API. If migrating from v3, consult the official v3-to-v4 migration guide for breaking changes to hook signatures and behavior.