Skip to main content
Home

Built and signed on GitHub Actions

Sentry middleware for Inngest.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
4 months ago (0.1.2)

@inngest/middleware-sentry

This package provides a middleware for Inngest to interface with Sentry.

Features

  • Capture exceptions for reporting
  • Add tracing to each function run
  • Include useful context for each exception and trace like function ID and event names

Installation

npm install @inngest/middleware-sentry
Note

Requires inngest@>=3.0.0 and @sentry/*@>=8.0.0`

Usage

To use the middleware, import and initialize it. It assumes that Sentry has already been initialized elsewhere in your code using Sentry.init().

import * as Sentry from "@sentry/node";
import { Inngest } from "inngest";
import { sentryMiddleware } from "@inngest/middleware-sentry";

// Initialize Sentry as usual wherever is appropriate
Sentry.init(...);

const inngest = new Inngest({
  id: "my-app",
  middleware: [sentryMiddleware()],
});

Flushing

By default, the middleware will force Sentry to flush as part of the Inngest request, ensuring all events, execptions, and traces are sent before a response is returned.

This is important for serverless environments where the runtime doesn't wait for the event loop to be empty and background tasks such as sending exception data may be lost.

If you're not in a serverless runtime or otherwise wish to have Sentry handle flushing itself, you can disable this behaviour by setting disableAutomaticFlush: true.

sentryMiddleware({
  disableAutomaticFlush: true,
});
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@inngest/middleware-sentry

Import symbol

import * as middleware_sentry from "@inngest/middleware-sentry";
or

Import directly with a jsr specifier

import * as middleware_sentry from "jsr:@inngest/middleware-sentry";

Add Package

pnpm i jsr:@inngest/middleware-sentry
or (using pnpm 10.8 or older)
pnpm dlx jsr add @inngest/middleware-sentry

Import symbol

import * as middleware_sentry from "@inngest/middleware-sentry";

Add Package

yarn add jsr:@inngest/middleware-sentry
or (using Yarn 4.8 or older)
yarn dlx jsr add @inngest/middleware-sentry

Import symbol

import * as middleware_sentry from "@inngest/middleware-sentry";

Add Package

npx jsr add @inngest/middleware-sentry

Import symbol

import * as middleware_sentry from "@inngest/middleware-sentry";

Add Package

bunx jsr add @inngest/middleware-sentry

Import symbol

import * as middleware_sentry from "@inngest/middleware-sentry";