npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@beignet/provider-error-reporting-sentry

v0.0.66

Published

Sentry error reporting provider for Beignet

Readme

@beignet/provider-error-reporting-sentry

Runtime: Beignet requires Node.js 22.12 or newer. Bun is optional.

Sentry-backed ErrorReporterPort provider for Beignet applications.

The provider installs ctx.ports.errorReporter using @sentry/node while keeping Sentry imports out of contracts, use cases, routes, and domain code.

Install

bun add @beignet/provider-error-reporting-sentry @beignet/core @sentry/node

Supports @sentry/node ^10.58.0 || ^11.9.0. New CLI integrations install ^11.10.0; existing apps can retain v10. Use a supported Node LTS release; Sentry 11 excludes Node 23.0–23.1 and requires Bun 1.3.14+ on Bun.

Register

// server/providers.ts
import { createSentryErrorReportingProvider } from "@beignet/provider-error-reporting-sentry";

export const providers = [
  createSentryErrorReportingProvider({
    dsn: process.env.SENTRY_DSN,
    init: {
      environment: process.env.NODE_ENV,
    },
  }),
];

With no dsn, SENTRY_DSN, or explicit init options, the provider contributes the Beignet port without initializing Sentry. This supports local development with stable wiring before production secrets exist.

beignet doctor --strict checks that installed Sentry providers are registered in server/providers.ts. SENTRY_DSN is optional by metadata because local development may intentionally run with a no-op Sentry client.

Sentry 11 collection and tracing

When the provider initializes Sentry 11, it disables automatic user/IP data, cookies, HTTP bodies, database query parameters, queue payloads, GenAI and MCP inputs/outputs, and GraphQL documents/variables. Headers and URL query parameters use Sentry's documented v10-style exclusions (forwarded, -ip, remote-, via, -user). Other SDK collection and filtering behavior remains in effect. Opt into individual categories through native SDK options:

createSentryErrorReportingProvider({
  dsn: process.env.SENTRY_DSN,
  init: {
    dataCollection: {
      cookies: { allow: ["locale"] },
      genAI: { inputs: true },
    },
  },
});

Omitted or undefined fields retain these defaults, including nested fields. For example, GenAI outputs and MCP collection remain disabled in this example. Sentry 11.9 is the minimum supported v11 release because earlier versions use the GenAI settings for MCP payloads and cannot enforce these independent opt-ins. Explicit header allow/deny rules replace the corresponding default rule. Direct createSentryErrorReporter clients retain their app-owned initialization policy. Explicit report metadata and exception content still need the filtering described below; these defaults are not a guarantee that events contain no PII.

For an app-owned OpenTelemetry SDK, register that SDK first, then configure Sentry 11 to associate errors with its active spans:

import { openTelemetryIntegration } from "@sentry/node";

createSentryErrorReportingProvider({
  init: {
    enableOpenTelemetrySetup: false,
    integrations: [openTelemetryIntegration()],
  },
});

Leave Sentry's tracesSampleRate and tracesSampler unset to avoid independent Sentry spans. The app's OpenTelemetry SDK owns sampling and exporting.

init uses the installed Sentry major's native types. Sentry 10 behavior is unchanged: use sendDefaultPii and skipOpenTelemetrySetup: true there. Sentry 11 removes those options in favor of dataCollection and enableOpenTelemetrySetup. See the Sentry migration guide for additional changes, including self-hosted server requirements.

Capture HTTP failures

Register createErrorReportingHooks(...) in server/index.ts so unexpected route and server failures are captured through ctx.ports.errorReporter.

import { createErrorReportingHooks } from "@beignet/core/server";
import { createNextServer, createNextServerLoader } from "@beignet/next";
import type { AppContext } from "@/app-context";
import { initialPorts } from "@/infra/port-wiring";
import { appContext } from "./context";
import { routes } from "./routes";

export const getServer = createNextServerLoader(async () => {
  const { providers } = await import("./providers");

  return createNextServer({
    ports: initialPorts,
    providers,
    hooks: [createErrorReportingHooks<AppContext>()],
    context: appContext,
    routes,
  });
});

The hook skips expected application catalog errors, auth denials, tenant requirements, idempotency conflicts, entitlement denials, and request validation failures by default. Use mapUnhandledError for response bodies; the hook only observes and reports.

Use

await ctx.ports.errorReporter.captureException(error, {
  level: "error",
  requestId: ctx.requestId,
  traceId: ctx.traceId,
  tags: {
    feature: "billing",
  },
  contexts: {
    tenant: { id: ctx.tenant.id },
  },
});

The provider also contributes ctx.ports.sentry as an escape hatch with the raw Sentry SDK and configured client.

Structured user metadata, tags, contexts, and extras pass through Beignet's default sensitive-key redaction before reaching Sentry. Add domain-specific keys with redaction; the defaults always remain active:

createSentryErrorReportingProvider({
  dsn: process.env.SENTRY_DSN,
  redaction: {
    sensitiveKeys: ["privateNote", "medicalRecord"],
  },
});

Redaction does not rewrite the captured exception message, stack, or arbitrary non-sensitive PII such as an explicitly supplied email address. Keep exception messages safe and use Sentry beforeSend or the raw escape hatch when an app needs domain-aware event filtering. Default HTTP hooks skip AppError instances and never copy AppError.details into report metadata; manual captures remain app-owned.

Devtools

Captured exceptions and messages are recorded as Beignet error instrumentation under the errors watcher when devtools or another instrumentation sink is installed before the provider.

API

createSentryErrorReporter(options)

Creates an ErrorReporterPort from a Sentry-compatible client. Use this for tests or custom provider composition.

createSentryErrorReportingProvider(options)

Creates a Beignet lifecycle provider that contributes:

  • ctx.ports.errorReporter, the standard Beignet ErrorReporterPort
  • ctx.ports.sentry, an escape hatch with the raw Sentry client and SDK

createSentryErrorReportingProvider()

Ready-to-register provider using the default Sentry singleton and process.env.SENTRY_DSN when present.

Failure behavior

captureException(...) and captureMessage(...) resolve after handing work to Sentry's SDK. With no configured DSN, the Beignet port is still present and capture calls become local no-ops apart from Beignet instrumentation. SDK transport failures follow Sentry's buffering and delivery behavior.

Local and tests

Leave SENTRY_DSN unset locally when you only need stable app wiring. Use a fake ErrorReporterPort in use-case tests and assert error-reporting hooks at the route/server boundary when the reporting behavior matters.

Maintainers can run bun run test:compatibility in this package to compile and exercise Sentry 10.58.0, 10.78.0, 11.9.0, and the installed v11 SDK. It checks real SDK envelopes on Node and Bun, app-owned OpenTelemetry, and automatic HTTP collection on Node using loopback requests and an in-memory Sentry transport. Actual MCP tool calls verify that GenAI opt-ins leave MCP payloads excluded and that explicit MCP input/output opt-ins work independently.

Deployment notes

Set SENTRY_DSN and Sentry environment/release metadata per deployed environment. Register createErrorReportingHooks(...) in server/index.ts if HTTP/server failures should be captured automatically.