inngest / inngest-js

The developer platform for easily building reliable workflows with zero infrastructure for TypeScript & JavaScript
https://www.inngest.com/
GNU General Public License v3.0
414 stars 41 forks source link

New `@inngest/middleware-sentry` package #598

Closed jpwilliams closed 3 months ago

jpwilliams commented 3 months ago

Summary

A new @inngest/middleware-sentry package, intended to replace the current example, supporting exception capturing and basic traces.

Usage

[!IMPORTANT]
While testing, use the build from this PR at @inngest/middleware-sentry@pr-598.

npm install @inngest/middleware-sentry@pr-598
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()],
});

Options

sentryMiddleware({
  ...
});

disableAutomaticFlush?: boolean

If true, the Sentry middleware will not automatically flush events after each function run. This can be useful if you want to control when events are sent to Sentry, or leave it to Sentry's default behavior.

By default, automatic flushing is enabled to ensure that events are sent in serverless environments where the runtime may be terminated if the function has returned a value.

Defaults to false.

Checklist

Related

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: aaa6e5f3e78480f6ccc7c919f6095ea8b9890dea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------------------- | ----- | | @inngest/middleware-sentry | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

inngest-release-bot commented 3 months ago

A user has added the prerelease/middleware-sentry label, so this PR will be published to npm with the tag pr-598. It will be updated with the latest changes as you push commits to this PR.

You can install this prerelease version with:

npm install @inngest/middleware-sentry@pr-598

The last release was built and published from aaa6e5f3e78480f6ccc7c919f6095ea8b9890dea.

brijmcq commented 3 months ago

@jpwilliams your middleware works on my end.