Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@vrplatform/inngest

inngest40GPL-3.03.15.7TypeScript support: included

Official SDK for Inngest.com. Inngest is the reliability layer for modern applications. Inngest combines durable execution, events, and queues into a zero-infra platform with built-in observability.

inngest, task manager, workflow, workflows, orchestration, task orchestration, events, webhooks, task scheduler, scheduled jobs, cron jobs, queue, serverless event-driven systems, job scheduler, background jobs, step function, job processing, llm prompt chaining, durable execution, longrunning, long-running, task sequencing, durable workflow, reliability, reliability layer, parallel processing, flow control

readme




Inngest is the reliability layer for modern applications. It combines durable execution, events, and queues into a zero-infra platform with built-in observability.

Inngest enables serverless event-driven queues, background jobs, and scheduled jobs for TypeScript. Works with any framework and platform.

Read the documentation and get started in minutes.



On any serverless platform (Next.js, Deno Deploy, RedwoodJS, AWS Lambda, and anything else) and with no extra infrastructure:

  • ⚡ Write background jobs
  • 🕐 Create scheduled and cron jobs
  • ♻️ Build serverless queues
  • 🪜 Write complex step functions
  • 🚘 Build serverless event-driven systems
  • 🪝 Reliably respond to webhooks, with retries and payloads stored for history

👋 Have a question or feature request? Join our Discord!


Getting started · Features · Contributing · Documentation


Getting started


Install Inngest:

npm install inngest  # or yarn add inngest

Writing functions

Write serverless functions and background jobs right in your own code:

import { Inngest } from "inngest";

const inngest = new Inngest({ name: "My App" });

// This function will be invoked by Inngest via HTTP any time
// the "app/user.signup" event is sent to to Inngest
export default inngest.createFunction(
  { name: "User onboarding communication" },
  { event: "app/user.signup" },
  async ({ event, step }) => {
    await step.run("Send welcome email", async () => {
      await sendEmail({
        email: event.data.email,
        template: "welcome",
      });
    });
  }
);
  • Functions are triggered by events which can be sent via this SDK, webhooks, integrations, or with a simple HTTP request.
  • When a matching event is received, Inngest invokes the function automatically, with built-in retries.

Serving your functions

Inngest invokes functions via HTTP, so you need to serve them using an adapter for the framework of your choice. See all frameworks here in our docs. Here is an example using the Next.js serve handler:

// /pages/api/inngest.ts
import { Inngest } from "inngest";
// See the "inngest/next" adapter imported here:
import { serve } from "inngest/next";
import myFunction from "../userOnboardingCOmmunication"; // see above function

// You can create this in a single file and import where it's needed
const inngest = new Inngest({ name: "My App" });

// Securely serve your Inngest functions for remote invocation:
export default serve(inngest, [myFunction]);

Sending events to trigger functions

// Send events
import { Inngest } from "inngest";
const inngest = new Inngest({ name: "My App" });

// This will run the function above automatically, in the background
inngest.send("app/user.signup", {
  data: { email: "text@example.com", user_id: "12345" },
});
  • Events can trigger one or more functions automatically, enabling you to fan-out work.
  • Inngest stores a history of all events for observability, testing, and replay.

Features

  • Fully serverless: Run background jobs, scheduled functions, and build event-driven systems without any servers, state, or setup
  • Works with your framework: Works with Next.js, Redwood, Express, Cloudflare Pages, Nuxt, Fresh (Deno), and Remix
  • Deploy anywhere: Keep deploying to your existing platform: Vercel, Netlify, Cloudflare, Deno, Digital Ocean, etc.
  • Use your existing code: Write functions within your current project and repo
  • Fully typed: Event schemas, versioning, and governance out of the box
  • Observable: A full UI for managing and inspecting your functions

Contributing

Check out CONTRIBUTING.md to get started.

changelog

inngest

3.15.4

Patch Changes

3.15.3

Patch Changes

3.15.2

Patch Changes

  • #503 f6088e0 Thanks @jpwilliams! - Fix onSendEvent.transformInput() middleware hooks not running for step.invoke() payloads

3.15.1

Patch Changes

3.15.0

Minor Changes

  • #488 3d2429d Thanks @jpwilliams! - INN-2754 Add support for INNGEST_DEV and the isDev option, allowing a devleoper to explicitly set either Cloud or Dev mode

Patch Changes

3.14.2

Patch Changes

3.14.1

Patch Changes

  • #493 adaa948 Thanks @goodoldneon! - Fix registration reusing deployment IDs when reusing connections in serverless or serverful

3.14.0

Minor Changes

Patch Changes

3.13.0

Minor Changes

Patch Changes

3.12.0

Minor Changes

  • #411 3b35c1c Thanks @jpwilliams! - Add handling of per-step errors and returning step names during error cases to better display issues in the UI

Patch Changes

3.11.0

Minor Changes

Patch Changes

3.10.0

Minor Changes

  • #449 a452cf1 Thanks @jpwilliams! - Add referenceFunction(), allowing easier, typed invocation of functions across apps and languages

  • #459 eec41d2 Thanks @jpwilliams! - Add new Inngest.Any and InngestFunction.Any type helpers

Patch Changes

  • #460 a225206 Thanks @MonsterDeveloper! - Add exports for FinishedEventPayload and Context types to fix a TypeScript error when using Inngest in projects with composite setting in tsconfig.

3.9.0

Minor Changes

  • #453 be6eb2a Thanks @jpwilliams! - Pass reqArgs to onFunctionRun middleware hook to be able to use request values within an Inngest function

3.8.0

Minor Changes

3.7.4

Patch Changes

  • #434 cb953ee Thanks @jpwilliams! - Fix bad wildcard export inngest/components/* for ESM/CJS compatibility

  • #440 0fc642d Thanks @jpwilliams! - Fix an issue where Sentry's wrapping of inngest/express caused Sentry to throw a runtime error during instantiation

3.7.3

Patch Changes

3.7.2

Patch Changes

  • #426 49a58d1 Thanks @jpwilliams! - Fix internal inngest/* events not being present when using new EventSchemas()

  • #427 5cf349c Thanks @jpwilliams! - Fix EventPayload.id missing from typing when attempting to send events with inngest.send() or step.sendEvent()

3.7.1

Patch Changes

  • #421 471d11f Thanks @jpwilliams! - Fix serverless use of inngest/next with next@>=13.0.0 <13.5.0 failing to return a response, as well as next@>=13.5.0 logging the same error

3.7.0

Minor Changes

  • #368 e7e845e Thanks @jpwilliams! - Add step.invoke(), providing the ability to directly invoke a function as a step

Patch Changes

3.6.2

Patch Changes

  • #409 b56a33e Thanks @jpwilliams! - Support Remix env vars on Cloudflare Pages via context.env

  • #400 428a591 Thanks @jpwilliams! - Fix Next.js 13 host being stubborn when relying on req.url for hosts such as host.docker.internal

  • #408 4066217 Thanks @jpwilliams! - Forward X-Inngest-Server-Kind headers to assist in preventing some issues with registration handshakes

  • #406 be5544b Thanks @jpwilliams! - Fix correctness issues in generated *.d.ts files, causing errors for some versions/configurations of TypeScript with skipLibCheck: false

3.6.1

Patch Changes

3.6.0

Minor Changes

3.5.0

Minor Changes

3.4.4

Patch Changes

3.4.3

Patch Changes

  • #385 cdf02a3 Thanks @MonsterDeveloper! - Add exports for InngestFunction, FunctionTrigger, and Handler types to fix a TypeScript error when using Inngest in projects with composite setting in tsconfig.

3.4.2

Patch Changes

3.4.1

Patch Changes

  • #371 d45bfbd Thanks @jpwilliams! - Remove JsonifyObject<> wrapper from step output - it's now clearer to see the actual type of a step's result

  • #375 e19f9b4 Thanks @jpwilliams! - Fix failing to parse BigInt during step/function result serialization; it is now correctly typed and returned as never

  • #374 dcafc2b Thanks @jpwilliams! - Fixed an issue where an error log wasn't shown if execution result parsing failed, such as in the case of serialization failures

3.4.0

Minor Changes

Patch Changes

3.3.0

Minor Changes

3.2.1

Patch Changes

  • #360 260dd75 Thanks @jpwilliams! - Inngest errors now appear more succintly in UIs, free of ANSI codes and verbose information

3.2.0

Minor Changes

Patch Changes

  • #357 9140b66 Thanks @jpwilliams! - Stop "Failed to send event" errors occuring in local development when missing an event key

  • #359 7f70546 Thanks @goodoldneon! - Internally, steps now return a displayName to be used within Inngest's UIs

3.1.1

Patch Changes

3.1.0

Minor Changes

Patch Changes

3.0.2

Patch Changes

3.0.1

Patch Changes

3.0.0

Major Changes

  • #294 f2f4856 Thanks @jpwilliams! - Clients and functions now require IDs

    When instantiating a client using new Inngest() or creating a function via inngest.createFunction(), it's now required to pass an id instead of a name.

    Previously only name was required, but this implied that the value was safe to change. Internally, we used this name to produce an ID which was used during deployments and executions.

    See the v3 migration guide.

  • #294 f2f4856 Thanks @jpwilliams! - Refactored available environment variables and configuration

    The arrangement of environment variables available has shifted a lot over the course of v2, so in v3 we've streamlined what's available and how they're used.

    See the v3 migration guide.

  • #294 f2f4856 Thanks @jpwilliams! - In v2, providing a fns option when creating a function -- an object of functions -- would wrap those passed functions in step.run(), meaning you can run code inside your function without the step.run() boilerplate.

    This wasn't a very well advertised feature and had some drawbacks, so we're instead replacing it with some optional middleware.

    See the v3 migration guide.

  • #294 f2f4856 Thanks @jpwilliams! - Serving functions could become a bit unwieldy with the format we had, so we've slightly altered how you serve your functions to ensure proper discoverability of options and aid in readability when revisiting the code.

    See the v3 migration guide.

  • #294 f2f4856 Thanks @jpwilliams! - Shorthand function creation removed

    inngest.createFunction() can no longer take a string as the first or second arguments; an object is now required to aid in the discoverability of options and configuration.

    See the v3 migration guide.

  • #294 f2f4856 Thanks @jpwilliams! - All steps require IDs

    When using any step.* tool, an ID is now required to ensure that determinism across changes to a function is easier to reason about for the user and the underlying engine.

    The addition of these IDs allows you to deploy hotfixes and logic changes to long-running functions without fear of errors, failures, or panics. Beforehand, any changes to a function resulted in an irrecoverable error if step definitions changed. With this, changes to a function are smartly applied by default.

    See the v3 migration guide.

Patch Changes

  • #333 67bda66 Thanks @goodoldneon! - (Internal) Fix missing name on NonRetriableError, ensuring it's correctly (de)serialized

2.7.2

Patch Changes

  • #323 3b2efa6 Thanks @jpwilliams! - Better error handling for .sendEvent() errors from Inngest API, ensuring easier debugging when failing to send events - partial of #256

2.7.1

Patch Changes

  • #325 b8858c9 Thanks @jpwilliams! - Hotfix: Ensure ProxyLogger (and some other used classes/types) is correctly exported from "inngest"

2.7.0

Minor Changes

Patch Changes

2.6.1

Patch Changes

2.6.0

Minor Changes

  • #202 21053ed Thanks @djfarrelly! - Add support for Fastify, either via a custom .route() or using a Fastify plugin

    import Fastify from "fastify";
    import inngestFastify, { serve } from "inngest/fastify";
    import { functions, inngest } from "./inngest";
    
    const fastify = Fastify({
      logger: true,
    });
    
    // The lead maintainer of Fastify recommends using this as a plugin:
    fastify.register(inngestFastify, {
      client: inngest,
      functions,
      options: {},
    });
    
    // We do also export `serve()` if you want to use it directly, though.
    fastify.route({
      method: ["GET", "POST", "PUT"],
      handler: serve(inngest, functions),
      url: "/api/inngest",
    });
    
    fastify.listen({ port: 3000 }, function (err, address) {
      if (err) {
        fastify.log.error(err);
        process.exit(1);
      }
    });
  • #298 4984aa8 Thanks [@z.object({](https://github.com/z.object({), [@z.object({](https://github.com/z.object({)! - Add the ability to provide Zod schemas using z.object() instead of requiring a record format

    // Previously we supported this
    new EventSchemas().fromZod({
      "test.event": {
        data: z.object({ a: z.string() }),
     b: z.number() }),
      },
    });
    
    // Now we ALSO support this
    new EventSchemas().fromZod([
      z.object({
        name: z.literal("test.event"),
        data: z.object({ a: z.string() }),
     b: z.number() }),
      }),
    ]);

    This should help if you wish to declare your events piece-by-piece instead of in a single object.

    const firstEvent = z.object({
      name: z.literal("app/user.created"),
      data: z.object({ id: z.string() }),
    });
    
    const secondEvent = z.object({
      name: z.literal("shop/product.deleted"),
      data: z.object({ id: z.string() }),
    });
    
    new EventSchemas().fromZod([firstEvent, secondEvent]);

    You can use the exported LiteralZodEventSchema type to provide some autocomplete when writing your events, too.

    const ShopProductOrdered = z.object({
      name: z.literal("shop/product.ordered"),
      data: z.object({ productId: z.string() }),
    }) satisfies LiteralZodEventSchema;

2.5.2

Patch Changes

  • #305 10220af Thanks @jpwilliams! - Always attempt accessing the dev server if the INNGEST_DEVSERVER_URL environment variable is specified

    This helps some situations where a user may want to run integration tests against a deployed or otherwise production build, using the Inngest Dev Server to do so.

2.5.1

Patch Changes

  • #302 5b2bfac Thanks @jpwilliams! - Remove preinstall script from inngest package causing errors when consuming the package

2.5.0

Minor Changes

  • #289 b04d904 Thanks @jpwilliams! - Add attempt number to SDK function context

    inngest.createFunction(
      { name: "Example Function" },
      { event: "app/user.created" },
      async ({ attempt }) => {
        // ...
      },
    );

Patch Changes

2.4.1

Patch Changes

  • f2ffc8b: Fix cross-fetch import issue in testing environemtnst. API package also uses custom fetch passed via arguments.
  • acfa07c: Throw error when using inngest/express and not using a body parser
  • b535e1e: Ensure users are not allowed to configure batching with cancellation or rate limiting, as these features do not yet function together
  • c271eb1: Add x-inngest-no-retry: true header when non-retriable for internal executor changes
  • 2a93f0b: Fix onFailure functions missing types applied by middleware

2.4.0

Minor Changes

  • 6cb6719: Allow filtering of events within triggers

Patch Changes

  • 55c889c: Expose raw error message if status is unknown

2.3.0

Minor Changes

  • 7792a62: Add support for streaming to inngest/remix

2.2.1

Patch Changes

  • 1120e29: Genercize mixed async error; the same symptom can be caused by a few different errors

2.2.0

Minor Changes

  • d0a8976: Add support for batching events.

    Introduces a new configuration to function configurations.

    batchEvents?: { maxSize: 100, timeout: "5s" }

    This will take Inngest start execution when one of the following conditions are met.

    1. The batch is full
    2. Time is up

    When the SDK gets invoked, the list of events will be available via a newly exported field events.

    createFunction(
      { name: "my func", batchEvents: { maxSize: 100, timeout: "5s" } },
      { event: "my/event" },
      async ({ event, events, step }) => {
        // events is accessible with the list of events
        // event will still be a single event object, which will be the
        // 1st event of the list.
    
        const result = step.run("do something with events", () => {
          return events.map(() => doSomething());
        });
    
        return { success: true, result };
      },
    );

Patch Changes

  • 591f73d: Set ts field on sent events if undefined
  • 1cbf65e: Alter registration response to include modified for deployment deduplication

2.1.0

Minor Changes

  • b74477f: Add optional id property to all step tooling, allowing users to override state recovery

2.0.2

Patch Changes

  • 023d761: Harden error serialization to ensure uncaught exceptions don't slip through during function runs

2.0.1

Patch Changes

  • 3ef0b36: Add better visibility into serve handlers issues
  • 4226b85: Fix middleware transformOutput hook not running if an asynchronous, non-step function's body threw
  • cc3929d: Fix a very rare bug in which step.sleep() hashing could produce different IDs across different executions

2.0.0

Major Changes

  • 4f29f5c: Removed tools parameter (breaking). This was marked as @deprecated in v1, but is being fully removed in v2. Use step instead. See the v2 migration guide.
  • 4f29f5c: Renamed throttle to rateLimit. See the v2 migration guide.
  • 4f29f5c: Added the ability to provide middleware when defining Inngest clients and functions, hooking into a client's lifecycle to add custom functionality like error monitoring, data transformations, and more. See Advanced: Middleware - Inngest Documentation.
  • 4f29f5c: Removed ability to serve() without a client (breaking). See the v2 migration guide.
  • 4f29f5c: Better event schema definitions (breaking), providing an extensible metho of creating and maintaining event payloads with a variety of native tools and third-party libraries. See Defining Event Payload Types - Inngest Documentation.
  • 4f29f5c: Removed some overloads of inngest.send() to provide a better TS experience when sending events (breaking). See the v2 migration guide.

Minor Changes

  • 4f29f5c: Added a logger to Inngest functions in addition to allowing users to provide a custom logger to reliably push logs to external services and handle flushing on serverless environments. See Logging in Inngest - Inngest Documentation.
  • 4f29f5c: Add GetEvents<> export which can be used to pull final event types from an Inngest client. See Defining Event Payload Types.
  • 4f29f5c: Add ability to provide concurrency: { limit: number } in function config, ready for more config options.

Patch Changes

  • b62cd6d: Update landing page vite dependency to v3.2.7

1.9.4

Patch Changes

  • 7d025d6: Fix NonRetriableError not working when thrown from within a step

1.9.3

Patch Changes

  • 64c397e: Handle circular JSON errors while stringifying across the SDK

1.9.2

Patch Changes

  • 71b1a17: Fix Vercel platform check to support local dev while using vercel env pull

1.9.1

Patch Changes

  • 49ddbb5: Add platform deploy checks

1.9.0

Minor Changes

  • 48d94a2: Allow user provided logger to be used within functions (experimental)

1.8.5

Patch Changes

  • 34f9ee8: INN-1253 Show actionable error when steps are nested

1.8.4

Patch Changes

  • aaac9e5: When recommending event key fixes, recommend setting env vars first

1.8.3

Patch Changes

  • c09261b: INN-1348 Throw an actionable error when we detect mixed async logic
  • 98c15b3: INN-1347 Fix deadlock when an async function finds a step

1.8.2

Patch Changes

  • 5462bdd: Ensure Inngest client's env object is used within serve()
  • 0b0c0ad: Add consistent type imports for slightly better tree-shaking

1.8.1

Patch Changes

  • 5573be3: INN-1270 Create an internal handler to enforce more actionable user-facing errors

1.8.0

Minor Changes

  • 65966f5: INN-1087 Add edge streaming support to "inngest/next" serve handler

Patch Changes

  • 164fd5c: INN-1266 Fix bad link for fetching Inngest signing key on landing page

1.7.1

Patch Changes

  • 34b6d39: INN-1240 Add queueMicrotask() fallback for restrictive environments

1.7.0

Minor Changes

  • c999896: INN-1029 Add env option to Inngest client to explicitly push to a particular Inngest env

Patch Changes

  • 131727a: Adjust README to have a slightly clearer intro
  • c999896: INN-1186 Send x-inngest-platform and x-inngest-framework headers during registration
  • 0728308: Expose run ID to function executions for user-managed logging and tracing
  • 3ac579f: Warn users when some functions appear undefined when serving
  • eb1ea34: Allow signing keys with multiple prefixes, as required for branch environment support

1.6.1

Patch Changes

  • a840e67: INN-1126 Execute a step early if it's the only pending item during a discovery

    This reduces the number of "Function steps" used for simple step functions.

1.6.0

Minor Changes

  • c7d1bee: Add onFailure handler to createFunction options, allowing you to specify a new function to run when the initial handler fails

1.5.4

Patch Changes

  • 071fe89: INN-1054 Ensure serve handlers return any instead of unknown so that they don't needlessly conflict with user types

1.5.3

Patch Changes

  • 906aca5: INN-1009 Show warnings when using the package with TS versions <4.7.2 and Node versions <14

    This includes tests to assert we appropriately support these versions now and in the future.

  • ca7d79e: Detect env vars from Node and Deno in serve handlers (INN-1012)

1.5.2

Patch Changes

  • 2d6e0b5: Fix infinite type instantiation using a looping type in serve handlers (thanks for the report, @grempe)

1.5.1

Patch Changes

  • 0836145: Refactor InngestCommHandler to better detect env and reduce duplication (INN-997)

1.5.0

Minor Changes

  • ac81320: Add "inngest/lambda" serve handler for AWS Lambda environments
  • f73a346: Add "inngest/edge" serve handler for use in v8 edge runtimes

1.4.1

Patch Changes

  • 43162d3: The "Connected to inngest dev" pill at the top of the SDK's landing page now links to the connected dev server.

    Thanks, @khill-fbmc!

    image

  • 56b8e9a: Removes many any types from the internal and public APIs.

    Affects the public API, so will therefore be a package bump, but shouldn't affect any expected areas of use.

  • a45601e: Update dependency typescript to v5

    Including a bump for this as it does seem to fix some complex inference for future features.

1.4.0

Minor Changes

  • ebb8740: Add ability to control the concurrency of a specific function via the concurrency option when creating an Inngest function
  • e61cf0f: Add cancelOn option when creating a function, allowing you cancel execution of a function based on incoming events.

1.3.5

Patch Changes

  • a4f8ae8: Fixes a typing bug where both event and cron could be specified as a trigger at the same time.

    Multiple event triggers will be coming in a later update, but not in this format.

  • d6a8329: Ensure signatures are not validated during development

  • 950a2bc: Ensure inngest.send() and step.sendEvent() can be given an empty array without error