# @prairielearn/sentry

Latest version **6.0.2** (published 2026-11-04) · 0 weekly downloads

## Install

```sh
npm install @prairielearn/sentry
pnpm add @prairielearn/sentry
yarn add @prairielearn/sentry
bun add @prairielearn/sentry
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 6.0.2 |
| Published | 2026-11-04 |
| First published | 2022-09-01 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=24.0.0 |
| Dependencies | 3 |
| Unpacked size | 107.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 533 |
| Maintainers | nwalters512, mwest1066 |

## Links

- npm: https://www.npmjs.com/package/@prairielearn/sentry
- Repository: https://github.com/PrairieLearn/PrairieLearn
- npm.io page: https://npm.io/package/@prairielearn/sentry

## Dependencies (3)

- [execa](https://npm.io/package/execa.md) ^10.0.1
- [@sentry/core](https://npm.io/package/@sentry/core.md) ^11.9.0
- [@sentry/node](https://npm.io/package/@sentry/node.md) ^11.9.0

## Recent versions

- 6.0.2 (latest) — 2026-11-04
- 6.0.1 — 2026-10-22
- 6.0.0 — 2026-10-06
- 5.0.11 — 2026-10-01
- 5.0.10 — 2026-09-18
- 5.0.9 — 2026-08-11
- 5.0.8 — 2026-07-10
- 5.0.7 — 2026-06-01
- 5.0.6 — 2026-05-16
- 5.0.5 — 2026-04-30
- 5.0.4 — 2026-04-29
- 5.0.3 — 2026-03-06
- 5.0.2 — 2026-03-04
- 5.0.1 — 2026-01-31
- 5.0.0 — 2026-01-16
- … 51 more at https://npm.io/package/@prairielearn/sentry/versions

## README

# `@prairielearn/sentry`

Opinionated wrapper around `@sentry/core` and `@sentry/node`. The async `init` function automatically sets the release to the current Git revision, if available.

```ts
import { init } from '@prairielearn/sentry';

await init({
  dsn: 'DSN HERE',
  environment: 'ENVIRONMENT HERE',
});
```

## OpenTelemetry and request isolation

OpenTelemetry owns tracing, instrumentation, context propagation, sampling, and exporters. Initialize the application's OpenTelemetry provider before calling `init`. The default `openTelemetryIntegration` links Sentry errors to the active OTel trace without exporting spans to Sentry. Leave `tracesSampleRate` and `tracesSampler` unset. No Sentry tracer provider, span processor, propagator, or context manager is required.

Sentry v11 uses its own AsyncLocalStorage for scope isolation. Applications can continue using `requestHandler()` before Express routes and `expressErrorHandler()` after routes. Framework auto-instrumentation and runtime channel injection are disabled by default because applications load frameworks before the Sentry DSN is available. This also keeps manual error capture in charge: PrairieLearn assigns error IDs and translates Postgres errors into HTTP status codes before capture, whereas automatic Express capture would run earlier. HTTP and fetch breadcrumbs remain enabled, with Sentry spans and outgoing trace propagation disabled so they do not compete with OTel.

The wrapper preserves v10's restrictive automatic HTTP data collection defaults, while accepting v11's message stack traces and five lines of source context. Explicit request data and user information added by application middleware are still included; these defaults do not scrub manually attached event data. Sentry integrations for AI, databases, queues, and GraphQL are not enabled, so their data collection options are left unset. Callers can override SDK options when needed.

## Migrating from Sentry v10

`@sentry/node-core` was merged into `@sentry/node`. The `SentryContextManager` export was removed; use the default OTel context manager instead. The wrapper's `NodeOptions` and exported SDK types now follow Sentry v11. The local Express handler retains its `shouldHandleError` callback.

Node.js 24 satisfies Sentry v11's minimum of 20.19.0. Self-hosted Sentry must be version 26.4.2 or newer to be supported. See the [Sentry migration guide](https://github.com/getsentry/sentry-javascript/blob/develop/MIGRATION.md#upgrading-from-10x-to-11x) and [custom OpenTelemetry setup documentation](https://docs.sentry.io/platforms/javascript/guides/node/opentelemetry/custom-setup/).

---
_Source: https://npm.io/package/@prairielearn/sentry · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
