Official agent skill

Sentry Node SDK

by getsentry in getsentry/sentry-for-ai

Full Sentry SDK setup for Node.js, Bun, and Deno. An agent skill from getsentry/sentry-for-ai.

OfficialApache-2.0Auto-check passedBackend & APIs

Install Sentry Node SDK

skills CLI
$ npx skills add getsentry/sentry-for-ai --skill sentry-node-sdk -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install getsentry/sentry-for-ai sentry-node-sdk --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/getsentry/sentry-for-ai.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills-legacy/sentry-node-sdk .claude/skills/sentry-node-sdk && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
sentry-node-sdk
GitHub stars
268
Token cost
~8.4k tokens
SKILL.md length
2,331 words
Files
8 (incl. references)
Skills in repo
32
Repo updated
First seen
Licence
Apache-2.0

At a glance

Full Sentry SDK setup for Node.js, Bun, and Deno. An agent skill from getsentry/sentry-for-ai.

  • Works in 4 steps: Detect → Recommend → Guide → …
  • Asked to add Sentry to Node.js
  • SKILL.md covers Invoke This Skill When, Phase 1: Detect, Phase 2: Recommend and Phase 3: Guide, plus 4 more sections
  • Calls bun, node and npm; reaches docs.sentry.io; needs SENTRY_AUTH_TOKEN

What it does

Sentry Node SDK is an agent skill from getsentry/sentry-for-ai, published by the product's own GitHub organization. Full Sentry SDK setup for Node.js, Bun, and Deno. Use when asked to "add Sentry to Node.js", "add Sentry to Bun", "add Sentry to Deno", "install @sentry/node", "@sentry/bun", or "@sentry/deno", or configure error monitoring, tracing, logging, profiling, metrics, crons, or AI monitoring for server-side JavaScript/TypeScript runtimes.

Its SKILL.md is about 8.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including reference files (for example `references/ai-monitoring.md`, `references/crons.md` and `references/error-monitoring.md`).

It sits in Backend & APIs, covering Scheduled and recurring tasks and Backend development. It works with Sentry, Deno, Node.js and JavaScript. The repository describes itself as: Teach your AI coding assistant how to use Sentry - setup, debugging, alerts, and more. The licence is Apache-2.0.

When your agent uses it

  • Asked to add Sentry to Node.js
  • Add Sentry to Bun
  • Add Sentry to Deno
  • Install @sentry/node

Example prompts

  • “add Sentry to Node.js”
  • “add Sentry to Bun”
  • “add Sentry to Deno”
  • “/sentry-node-sdk”

Requirements

  • Node.js

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Detect
  2. Recommend
  3. Guide
  4. Cross-Link

What it can do on your machine

Read from SKILL.md and the folder at commit d8fd106. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • bun
    • node
    • npm
    • deno
    • yarn
    • pnpm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • docs.sentry.io

    Also links to:

    • sentry.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • SENTRY_AUTH_TOKEN

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Sentry Node SDK loads about 8.4k tokens when it runs, and up to ~36k if it reads all its reference files. Until then it costs about 88 tokens; SKILL.md has 2,331 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~88
When it runs · the whole SKILL.md, loaded when a task matches
~8.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~36k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from getsentry/sentry-for-ai at commit d8fd106, republished under its Apache-2.0 licence (© getsentry). 2,331 words, ~8,415 tokens.

Download SKILL.mdSave it as .claude/skills/sentry-node-sdk/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
sentry-node-sdk
description
Full Sentry SDK setup for Node.js, Bun, and Deno. Use when asked to "add Sentry to Node.js", "add Sentry to Bun", "add Sentry to Deno", "install @sentry/node", "@sentry/bun", or "@sentry/deno", or configure error monitoring, tracing, logging, profiling, metrics, crons, or AI monitoring for server-side JavaScript/TypeScript runtimes.
license
Apache-2.0
category
sdk-setup
parent
sentry-sdk-setup
disable-model-invocation
true

All Skills > SDK Setup > Node.js / Bun / Deno SDK

Sentry Node.js / Bun / Deno SDK

Opinionated wizard that scans your project and guides you through complete Sentry setup for server-side JavaScript and TypeScript runtimes: Node.js, Bun, and Deno.

Invoke This Skill When

  • User asks to "add Sentry to Node.js", "Bun", or "Deno"
  • User wants to install or configure @sentry/node, @sentry/bun, or @sentry/deno
  • User wants error monitoring, tracing, logging, profiling, crons, metrics, or AI monitoring for a backend JS/TS app
  • User asks about instrument.js, --import ./instrument.mjs, bun --preload, or npm:@sentry/deno
  • User wants to monitor Express, Fastify, Koa, Hapi, Connect, Bun.serve(), or Deno.serve()

NestJS? Use sentry-nestjs-sdk instead — it uses @sentry/nestjs with NestJS-native decorators and filters. Next.js? Use sentry-nextjs-sdk instead — it handles the three-runtime architecture (browser, server, edge).

Note: SDK versions below reflect current Sentry docs at time of writing (@sentry/node ≥10.42.0, @sentry/bun ≥10.42.0, @sentry/deno ≥10.42.0). Always verify against docs.sentry.io/platforms/javascript/guides/node/ before implementing.


Phase 1: Detect

Run these commands to identify the runtime, framework, and existing Sentry setup:

bash
# Detect runtime
bun --version 2>/dev/null && echo "Bun detected"
deno --version 2>/dev/null && echo "Deno detected"
node --version 2>/dev/null && echo "Node.js detected"

# Detect existing Sentry packages
cat package.json 2>/dev/null | grep -E '"@sentry/'
cat deno.json deno.jsonc 2>/dev/null | grep -i sentry

# Detect Node.js framework
cat package.json 2>/dev/null | grep -E '"express"|"fastify"|"@hapi/hapi"|"koa"|"@nestjs/core"|"connect"'

# Detect Bun-specific frameworks
cat package.json 2>/dev/null | grep -E '"elysia"|"hono"'

# Detect Deno frameworks (deno.json imports)
cat deno.json deno.jsonc 2>/dev/null | grep -E '"oak"|"hono"|"fresh"'

# Detect module system (Node.js)
cat package.json 2>/dev/null | grep '"type"'
ls *.mjs *.cjs 2>/dev/null | head -5

# Detect existing instrument file
ls instrument.js instrument.mjs instrument.ts instrument.cjs 2>/dev/null

# Detect logging libraries
cat package.json 2>/dev/null | grep -E '"winston"|"pino"|"bunyan"'

# Detect cron / scheduling
cat package.json 2>/dev/null | grep -E '"node-cron"|"cron"|"agenda"|"bull"|"bullmq"'

# Detect AI / LLM usage
cat package.json 2>/dev/null | grep -E '"openai"|"@anthropic-ai"|"@langchain"|"@vercel/ai"|"@google/generative-ai"'

# Detect OpenTelemetry tracing
cat package.json 2>/dev/null | grep -E '"@opentelemetry/sdk-node"|"@opentelemetry/sdk-trace-node"|"@opentelemetry/sdk-trace-base"'
grep -rn "NodeTracerProvider\|trace\.getTracer\|startActiveSpan" \
  --include="*.ts" --include="*.js" --include="*.mjs" 2>/dev/null | head -5

# Check for companion frontend
ls frontend/ web/ client/ ui/ 2>/dev/null
cat package.json 2>/dev/null | grep -E '"react"|"vue"|"svelte"|"next"'

What to determine:

QuestionImpact
Which runtime? (Node.js / Bun / Deno)Determines package, init pattern, and preload flag
Node.js: ESM or CJS?ESM requires --import ./instrument.mjs; CJS uses require("./instrument")
Framework detected?Determines which error handler to register
@sentry/* already installed?Skip install, go straight to feature config
instrument.js / instrument.mjs already exists?Merge into it rather than overwrite
Logging library detected?Recommend Sentry Logs
Cron / job scheduler detected?Recommend Crons monitoring
AI library detected?Recommend AI Monitoring
OpenTelemetry tracing detected?Use OTLP path instead of native tracing
Companion frontend found?Trigger Phase 4 cross-link

Phase 2: Recommend

Present a concrete recommendation based on what you found. Don't ask open-ended questions — lead with a proposal:

Route from OTel detection:

  • OTel tracing detected (@opentelemetry/sdk-node or @opentelemetry/sdk-trace-node in package.json, or NodeTracerProvider in source) → use OTLP path: otlpIntegration() via @sentry/node-core/light; do not set tracesSampleRate; Sentry links errors to OTel traces automatically

Recommended (core coverage):

  • ✅ Error Monitoring — always; captures unhandled exceptions, promise rejections, and framework errors
  • ✅ Tracing — automatic HTTP, DB, and queue instrumentation via OpenTelemetry

Optional (enhanced observability):

  • ⚡ Logging — structured logs via Sentry.logger.*; recommend when winston/pino/bunyan or log search is needed
  • ⚡ Profiling — continuous CPU profiling (Node.js only; not available on Bun or Deno); not available with OTLP path
  • ⚡ AI Monitoring — OpenAI, Anthropic, LangChain, Vercel AI SDK; recommend when AI/LLM calls detected
  • ⚡ Crons — detect missed or failed scheduled jobs; recommend when node-cron, Bull, or Agenda is detected
  • ⚡ Metrics — custom counters, gauges, distributions; recommend when custom KPIs needed
  • ⚡ Runtime Metrics — automatic collection of memory, CPU, and event loop metrics; nodeRuntimeMetricsIntegration() (Node.js) / bunRuntimeMetricsIntegration() (Bun)

Recommendation logic:

FeatureRecommend when...
Error MonitoringAlways — non-negotiable baseline
OTLP IntegrationOTel tracing detected — replaces native Tracing
TracingAlways for server apps — HTTP spans + DB spans are high-value; skip if OTel tracing detected
LoggingApp uses winston, pino, bunyan, or needs log-to-trace correlation
ProfilingNode.js only — performance-critical service; native addon compatible; skip if OTel tracing detected (requires tracesSampleRate, incompatible with OTLP)
AI MonitoringApp calls OpenAI, Anthropic, LangChain, Vercel AI, or Google GenAI
CronsApp uses node-cron, Bull, BullMQ, Agenda, or any scheduled task pattern
MetricsApp needs custom counters, gauges, or histograms
Runtime MetricsAny Node.js or Bun service wanting automatic memory/CPU/event-loop visibility

OTel tracing detected: "I see OpenTelemetry tracing in the project. I recommend Sentry's OTLP integration for tracing (via your existing OTel setup) + Error Monitoring + Sentry Logging [+ Metrics/Crons/AI Monitoring if applicable]. Shall I proceed?"

No OTel: "I recommend setting up Error Monitoring + Tracing. Want me to also add Logging or Profiling?"


Phase 3: Guide

Runtime: Node.js

You need to run this yourself — the wizard opens a browser for login and requires interactive input that the agent can't handle. Copy-paste into your terminal:

npx @sentry/wizard@latest -i node

It handles login, org/project selection, SDK installation, instrument.js creation, and package.json script updates.

Once it finishes, come back and skip to Verification.

If the user skips the wizard, proceed with Option 2 (Manual Setup) below.


Option 2: Manual Setup — Node.js
Install
bash
npm install @sentry/node --save
# or
yarn add @sentry/node
# or
pnpm add @sentry/node
Create the Instrument File

CommonJS (instrument.js):

javascript
// instrument.js — must be loaded before all other modules
const Sentry = require("@sentry/node");

Sentry.init({
  dsn: process.env.SENTRY_DSN ?? "___DSN___",

  dataCollection: {
    // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
    // https://docs.sentry.io/platforms/javascript/guides/node/configuration/options/#dataCollection
    // userInfo: false,
    // httpBodies: [],
  },

  // 100% in dev, lower in production
  tracesSampleRate: process.env.NODE_ENV === "development" ? 1.0 : 0.1,

  // Capture local variable values in stack frames
  includeLocalVariables: true,

  enableLogs: true,
});

ESM (instrument.mjs):

javascript
// instrument.mjs — loaded via --import flag before any other module
import * as Sentry from "@sentry/node";

Sentry.init({
  dsn: process.env.SENTRY_DSN ?? "___DSN___",

  dataCollection: {
    // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
    // https://docs.sentry.io/platforms/javascript/guides/node/configuration/options/#dataCollection
    // userInfo: false,
    // httpBodies: [],
  },
  tracesSampleRate: process.env.NODE_ENV === "development" ? 1.0 : 0.1,
  includeLocalVariables: true,
  enableLogs: true,
});
Start Your App with Sentry Loaded First

CommonJS — add require("./instrument") as the very first line of your entry file:

javascript
// app.js
require("./instrument"); // must be first

const express = require("express");
// ... rest of your app

ESM — use the --import flag so Sentry loads before all other modules (Node.js 18.19.0+ required):

bash
node --import ./instrument.mjs app.mjs

Add to package.json scripts:

json
{
  "scripts": {
    "start": "node --import ./instrument.mjs server.mjs",
    "dev": "node --import ./instrument.mjs --watch server.mjs"
  }
}

Or via environment variable (useful for wrapping existing start commands):

bash
NODE_OPTIONS="--import ./instrument.mjs" npm start
Framework Error Handlers

Register the Sentry error handler after all routes so it can capture framework errors:

Express:

javascript
const express = require("express");
const Sentry = require("@sentry/node");

const app = express();

// ... your routes

// Add AFTER all routes — captures 5xx errors by default
Sentry.setupExpressErrorHandler(app);

// Optional: capture 4xx errors too
// Sentry.setupExpressErrorHandler(app, {
//   shouldHandleError(error) { return error.status >= 400; },
// });

app.listen(3000);

Fastify:

javascript
const Fastify = require("fastify");
const Sentry = require("@sentry/node");

const fastify = Fastify();

// Add BEFORE routes (unlike Express!)
Sentry.setupFastifyErrorHandler(fastify);

// ... your routes

await fastify.listen({ port: 3000 });

Koa:

javascript
const Koa = require("koa");
const Sentry = require("@sentry/node");

const app = new Koa();

// Add as FIRST middleware (catches errors thrown by later middleware)
Sentry.setupKoaErrorHandler(app);

// ... your other middleware and routes

app.listen(3000);

Hapi (async — must await):

javascript
const Hapi = require("@hapi/hapi");
const Sentry = require("@sentry/node");

const server = Hapi.server({ port: 3000 });

// ... your routes

// Must await — Hapi registration is async
await Sentry.setupHapiErrorHandler(server);

await server.start();

Connect:

javascript
const connect = require("connect");
const Sentry = require("@sentry/node");

const app = connect();

// Add BEFORE routes (like Fastify and Koa)
Sentry.setupConnectErrorHandler(app);

// ... your middleware and routes

require("http").createServer(app).listen(3000);

NestJS — has its own dedicated skill with full coverage:

Use the sentry-nestjs-sdk skill instead. NestJS uses a separate package (@sentry/nestjs) with NestJS-native constructs: SentryModule.forRoot(), SentryGlobalFilter, @SentryTraced, @SentryCron decorators, and GraphQL/Microservices support. Load that skill for complete NestJS setup.

Vanilla Node.js http module — wrap request handler manually:

javascript
const http = require("http");
const Sentry = require("@sentry/node");

const server = http.createServer((req, res) => {
  Sentry.withIsolationScope(() => {
    try {
      // your handler
      res.end("OK");
    } catch (err) {
      Sentry.captureException(err);
      res.writeHead(500);
      res.end("Internal Server Error");
    }
  });
});

server.listen(3000);

Framework error handler summary:

FrameworkFunctionPlacementAsync?
ExpresssetupExpressErrorHandler(app)After all routesNo
FastifysetupFastifyErrorHandler(fastify)Before routesNo
KoasetupKoaErrorHandler(app)First middlewareNo
HapisetupHapiErrorHandler(server)Before server.start()Yes
ConnectsetupConnectErrorHandler(app)Before routesNo
NestJS→ Use sentry-nestjs-sdkDedicated skill—

Runtime: Bun

No wizard available for Bun. Manual setup only.

Install
bash
bun add @sentry/bun
Create instrument.ts (or instrument.js)
typescript
// instrument.ts
import * as Sentry from "@sentry/bun";

Sentry.init({
  dsn: process.env.SENTRY_DSN ?? "___DSN___",

  dataCollection: {
    // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
    // https://docs.sentry.io/platforms/javascript/guides/node/configuration/options/#dataCollection
    // userInfo: false,
    // httpBodies: [],
  },
  tracesSampleRate: process.env.NODE_ENV === "development" ? 1.0 : 0.1,
  enableLogs: true,
});
Start Your App with --preload
bash
bun --preload ./instrument.ts server.ts

Add to package.json:

json
{
  "scripts": {
    "start": "bun --preload ./instrument.ts server.ts",
    "dev": "bun --watch --preload ./instrument.ts server.ts"
  }
}
Bun.serve() — Auto-Instrumentation

@sentry/bun automatically instruments Bun.serve() via JavaScript Proxy. No extra setup is required — just initialize with --preload and your Bun.serve() calls are traced:

typescript
// server.ts
const server = Bun.serve({
  port: 3000,
  fetch(req) {
    return new Response("Hello from Bun!");
  },
});
Framework Error Handlers on Bun

Bun can run Express, Fastify, Hono, and Elysia. Use the same @sentry/bun import and the @sentry/node error handler functions (re-exported by @sentry/bun):

typescript
import * as Sentry from "@sentry/bun";
import express from "express";

const app = express();
// ... routes
Sentry.setupExpressErrorHandler(app);
app.listen(3000);
Bun Feature Support
FeatureBun SupportNotes
Error Monitoring✅ FullSame API as Node
Tracing✅ Via @sentry/node OTelMost auto-instrumentations work
Logging✅ FullenableLogs: true + Sentry.logger.*
Profiling❌ Not available@sentry/profiling-node uses native addons incompatible with Bun
Metrics✅ FullSentry.metrics.*
Runtime Metrics✅ FullbunRuntimeMetricsIntegration() — memory, CPU, event loop (no event loop delay percentiles)
Crons✅ FullSentry.withMonitor()
AI Monitoring✅ FullOpenAI, Anthropic integrations work

Runtime: Deno

No wizard available for Deno. Manual setup only. Requires Deno 2.0+. Deno 1.x is not supported. Use npm: specifier. The deno.land/x/sentry registry is deprecated.

json
{
  "imports": {
    "@sentry/deno": "npm:@sentry/deno@10.42.0"
  }
}

Or import directly with the npm: specifier:

typescript
import * as Sentry from "npm:@sentry/deno";
Initialize — Add to Entry File
typescript
// main.ts — Sentry.init() must be called before any other code
import * as Sentry from "@sentry/deno";

Sentry.init({
  dsn: Deno.env.get("SENTRY_DSN") ?? "___DSN___",

  dataCollection: {
    // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
    // https://docs.sentry.io/platforms/javascript/guides/node/configuration/options/#dataCollection
    // userInfo: false,
    // httpBodies: [],
  },
  tracesSampleRate: Deno.env.get("DENO_ENV") === "development" ? 1.0 : 0.1,
  enableLogs: true,
});

// Your application code follows
Deno.serve({ port: 8000 }, (req) => {
  return new Response("Hello from Deno!");
});

Unlike Node.js and Bun, Deno does not have a --preload or --import flag. Sentry must be the first import in your entry file.

Required Deno Permissions

The SDK requires network access to reach your Sentry ingest domain:

bash
deno run \
  --allow-net=o<ORG_ID>.ingest.sentry.io \
  --allow-read=./src \
  --allow-env=SENTRY_DSN,SENTRY_RELEASE \
  main.ts

For development, --allow-all works but is not recommended for production.

Deno Cron Integration

Deno provides native cron scheduling. Use denoCronIntegration for automatic monitoring:

typescript
import * as Sentry from "@sentry/deno";
import { denoCronIntegration } from "@sentry/deno";

Sentry.init({
  dsn: Deno.env.get("SENTRY_DSN") ?? "___DSN___",
  integrations: [denoCronIntegration()],
});

// Cron is automatically monitored
Deno.cron("daily-cleanup", "0 0 * * *", () => {
  // cleanup logic
});
Deno Feature Support
FeatureDeno SupportNotes
Error Monitoring✅ FullUnhandled exceptions + captureException
Tracing✅ Custom OTelAutomatic spans for Deno.serve() and fetch
Logging✅ FullenableLogs: true + Sentry.logger.*
Profiling❌ Not availableNo profiling addon for Deno
Metrics✅ FullSentry.metrics.*
Runtime Metrics❌ Not availableNo runtime metrics integration for Deno
Crons✅ FulldenoCronIntegration() + Sentry.withMonitor()
AI Monitoring✅ PartialVercel AI SDK integration works; OpenAI/Anthropic via npm:

OTLP Integration (OTel-First Projects — Node.js Only)

Use this path only when OpenTelemetry tracing was detected in Phase 1 (e.g., @opentelemetry/sdk-node or @opentelemetry/sdk-trace-node in package.json). For projects without an existing OTel setup, use the standard @sentry/node path above.

The OTLP integration uses @sentry/node-core/light — a lightweight Sentry SDK that does not bundle its own OpenTelemetry. Instead, it hooks into the user's existing OTel TracerProvider and exports spans to Sentry via OTLP.

When to Use
ScenarioRecommended path
New project, no existing OTelStandard @sentry/node (above) — includes built-in OTel
Existing OTel setup, want Sentry tracing@sentry/node-core/light + otlpIntegration()
Existing OTel setup, sending to own Collector@sentry/node-core/light + otlpIntegration({ collectorUrl })
Install
bash
npm install @sentry/node-core @opentelemetry/api @opentelemetry/sdk-trace-node @opentelemetry/sdk-trace-base
# or
yarn add @sentry/node-core @opentelemetry/api @opentelemetry/sdk-trace-node @opentelemetry/sdk-trace-base
# or
pnpm add @sentry/node-core @opentelemetry/api @opentelemetry/sdk-trace-node @opentelemetry/sdk-trace-base

The @opentelemetry/* packages are peer dependencies. If the project already has them installed, skip duplicates.

Initialize
javascript
// instrument.mjs — load via --import flag before any other module
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
import * as Sentry from '@sentry/node-core/light';
import { otlpIntegration } from '@sentry/node-core/light/otlp';

// Register the user's OTel TracerProvider first
const provider = new NodeTracerProvider();
provider.register();

Sentry.init({
  dsn: process.env.SENTRY_DSN ?? '___DSN___',

  dataCollection: {
    // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
    // https://docs.sentry.io/platforms/javascript/guides/node/configuration/options/#dataCollection
    // userInfo: false,
    // httpBodies: [],
  },
  enableLogs: true,

  // Do NOT set tracesSampleRate — OTel controls sampling
  integrations: [
    otlpIntegration({
      // Export OTel spans to Sentry via OTLP (default: true)
      setupOtlpTracesExporter: true,
    }),
  ],
});

With a custom Collector endpoint:

javascript
Sentry.init({
  dsn: process.env.SENTRY_DSN ?? '___DSN___',
  integrations: [
    otlpIntegration({
      collectorUrl: 'http://localhost:4318/v1/traces',
    }),
  ],
});
Start Your App

Same --import pattern as the standard Node.js setup:

bash
node --import ./instrument.mjs app.mjs
Key Differences from Standard @sentry/node
Aspect@sentry/node (standard)@sentry/node-core/light (OTLP)
OTel bundled✅ Yes — built-in TracerProvider❌ No — uses your existing provider
Tracing controltracesSampleRate in Sentry.init()OTel SDK controls sampling
Auto-instrumentation✅ Built-in (HTTP, DB, etc.)❌ You manage OTel instrumentations
Profiling✅ Available❌ Not compatible
Error ↔ trace linking✅ Automatic✅ Automatic (via otlpIntegration)
Package sizeLarger (includes OTel)Smaller (light mode)

For Each Agreed Feature

Load the corresponding reference file and follow its steps:

FeatureReference fileLoad when...
Error Monitoringreferences/error-monitoring.mdAlways (baseline) — captures, scopes, enrichment, beforeSend
OTLP IntegrationSee OTLP Integration aboveOTel tracing detected — replaces native Tracing
Tracingreferences/tracing.mdOTel auto-instrumentation, custom spans, distributed tracing, sampling; skip if OTel tracing detected
Loggingreferences/logging.mdStructured logs, Sentry.logger.*, log-to-trace correlation
Profilingreferences/profiling.mdNode.js only — CPU profiling, Bun/Deno gaps documented; skip if OTel tracing detected
Metricsreferences/metrics.mdCustom counters, gauges, distributions
Runtime MetricsSee inline belowAutomatic memory, CPU, and event loop metrics for Node.js and Bun
Cronsreferences/crons.mdScheduled job monitoring, node-cron, Bull, Agenda, Deno.cron
AI MonitoringLoad sentry-setup-ai-monitoring skillOpenAI, Anthropic, LangChain, Vercel AI, Google GenAI

For each feature: read the reference file, follow its steps exactly, and verify before moving on.

Show full SKILL.md (884 more words)Show less
Runtime Metrics

Automatically collect Node.js and Bun runtime health metrics (memory, CPU utilization, event loop delay/utilization, uptime) at a configurable interval. Metrics appear in Sentry's Metrics product under the node.runtime.* / bun.runtime.* namespace.

Node.js — add nodeRuntimeMetricsIntegration() to your instrument.js:

javascript
const Sentry = require("@sentry/node");

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  integrations: [
    Sentry.nodeRuntimeMetricsIntegration(),
    // Optional: change collection interval (default 30 000 ms)
    // Sentry.nodeRuntimeMetricsIntegration({ collectionIntervalMs: 60_000 }),
  ],
});

Metrics collected by default: node.runtime.mem.rss, node.runtime.mem.heap_used, node.runtime.mem.heap_total, node.runtime.cpu.utilization, node.runtime.event_loop.delay.p50, node.runtime.event_loop.delay.p99, node.runtime.event_loop.utilization, node.runtime.process.uptime.

Bun — add bunRuntimeMetricsIntegration() to your instrument.ts:

typescript
import * as Sentry from "@sentry/bun";
import { bunRuntimeMetricsIntegration } from "@sentry/bun";

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  integrations: [
    bunRuntimeMetricsIntegration(),
    // Optional: change collection interval (default 30 000 ms)
    // bunRuntimeMetricsIntegration({ collectionIntervalMs: 60_000 }),
  ],
});

Metrics collected: same as Node.js except no event loop delay percentiles (unavailable in Bun). Prefixed with bun.runtime.*.


Configuration Reference

Sentry.init() Core Options
OptionTypeDefaultNotes
dsnstring—Required. Also from SENTRY_DSN env var
tracesSampleRatenumber—0–1; required to enable tracing; do not set when using OTLP path
dataCollectionobjectconservative unless setFine-grained control over auto-collected categories (userInfo, cookies, httpHeaders, httpBodies, queryParams, genAI). When omitted, the SDK falls back to sendDefaultPii (default false). Passing the object — even {} — flips unset categories to their permissive defaults; opt out per category.
includeLocalVariablesbooleanfalseAdd local variable values to stack frames (Node.js)
enableLogsbooleanfalseEnable Sentry Logs product (v9.41.0+)
environmentstring"production"Also from SENTRY_ENVIRONMENT env var
releasestring—Also from SENTRY_RELEASE env var
debugbooleanfalseLog SDK activity to console
enabledbooleantrueSet false in tests to disable sending
sampleRatenumber1.0Fraction of error events to send (0–1)
shutdownTimeoutnumber2000Milliseconds to flush events before process exit
nativeNodeFetchIntegration() Options

Configures outgoing fetch/undici span capture. Since @opentelemetry/instrumentation-undici@0.22.0, response headers like content-length are no longer captured automatically — use headersToSpanAttributes to opt in:

javascript
Sentry.init({
  integrations: [
    Sentry.nativeNodeFetchIntegration({
      headersToSpanAttributes: {
        requestHeaders: ["x-request-id"],
        responseHeaders: ["content-length", "content-type"],
      },
    }),
  ],
});
OptionTypeDefaultNotes
breadcrumbsbooleantrueRecord breadcrumbs for outgoing fetch requests
headersToSpanAttributes.requestHeadersstring[]—Request header names to capture as span attributes
headersToSpanAttributes.responseHeadersstring[]—Response header names to capture as span attributes
otlpIntegration() Options (@sentry/node-core/light/otlp)

For OTel-first projects using @sentry/node-core/light. Import: import { otlpIntegration } from '@sentry/node-core/light/otlp'.

OptionTypeDefaultPurpose
setupOtlpTracesExporterbooleantrueAuto-configure OTLP exporter to send spans to Sentry; set false if you already export to your own Collector
collectorUrlstringundefinedOTLP HTTP endpoint of an OTel Collector (e.g., http://localhost:4318/v1/traces); when set, spans are sent to the collector instead of the DSN-derived Sentry endpoint
Graceful Shutdown

Flush buffered events before process exit — important for short-lived scripts and serverless:

javascript
process.on("SIGTERM", async () => {
  await Sentry.close(2000); // flush with 2s timeout
  process.exit(0);
});
Environment Variables
VariablePurposeRuntime
SENTRY_DSNDSN (alternative to hardcoding in init())All
SENTRY_ENVIRONMENTDeployment environmentAll
SENTRY_RELEASERelease version string (auto-detected from git)All
SENTRY_AUTH_TOKENSource map upload tokenBuild time
SENTRY_ORGOrg slug for source map uploadBuild time
SENTRY_PROJECTProject slug for source map uploadBuild time
NODE_OPTIONSSet --import ./instrument.mjs for ESMNode.js
Source Maps (Node.js)

Readable stack traces in production require uploading source maps with @sentry/cli or the webpack/esbuild/rollup plugins — for example, an inject + upload step in your build:

json
{
  "scripts": {
    "build": "tsc && sentry-cli sourcemaps inject ./dist && sentry-cli sourcemaps upload ./dist"
  }
}

Upload needs a SENTRY_AUTH_TOKEN (a build-time secret). For creating the token and wiring it into CI, see sentry-source-maps.


Verification

After setup, verify Sentry is receiving events:

javascript
// Add temporarily to your entry file or a test route, then remove
import * as Sentry from "@sentry/node"; // or @sentry/bun / @sentry/deno

Sentry.captureException(new Error("Sentry test error — delete me"));

Or trigger an unhandled exception:

javascript
// In a route handler or startup — will be captured automatically
throw new Error("Sentry test error — delete me");

Then check your Sentry Issues dashboard — the error should appear within ~30 seconds.

Verification checklist:

CheckHow
Error capturedThrow in a handler, verify in Sentry Issues
Tracing workingCheck Performance tab — should show HTTP spans
includeLocalVariables workingStack frame in Sentry should show variable values
Source maps workingStack trace shows readable file names, not minified

After completing backend setup, check for companion services:

bash
# Frontend companion
ls frontend/ web/ client/ ui/ 2>/dev/null
cat package.json 2>/dev/null | grep -E '"react"|"vue"|"svelte"|"next"'

# Other backend services
ls ../go.mod ../requirements.txt ../Gemfile 2>/dev/null

If a frontend, framework-specific SDK, or other backend is found, suggest the matching skill:

Dedicated JavaScript framework skills (prefer these over generic node-sdk):

DetectedPrefer skillWhy
NestJS (@nestjs/core in package.json)sentry-nestjs-sdkUses @sentry/nestjs with NestJS-native decorators, filters, and GraphQL support
Next.js (next in package.json)sentry-nextjs-sdkThree-runtime architecture (browser, server, edge), withSentryConfig, source map upload

Frontend companions:

DetectedSuggest
React app (react in package.json)sentry-react-sdk
Svelte/SvelteKitsentry-svelte-sdk

Other backend companions:

DetectedSuggest
Go backend (go.mod)sentry-go-sdk
Python backend (requirements.txt, pyproject.toml)sentry-python-sdk
Ruby backend (Gemfile)sentry-ruby-sdk

Connecting frontend and backend with the same DSN or linked projects enables distributed tracing — stack traces that span your browser, API server, and database in a single trace view.


Troubleshooting

IssueCauseSolution
Events not appearinginstrument.js loaded too lateEnsure it's the first require() / loaded via --import or --preload
Tracing spans missingtracesSampleRate not setAdd tracesSampleRate: 1.0 to Sentry.init()
ESM instrumentation not workingMissing --import flagRun with node --import ./instrument.mjs; import "./instrument.mjs" inside app is not sufficient
@sentry/profiling-node install fails on BunNative addon incompatibleProfiling is not supported on Bun — remove @sentry/profiling-node
Deno: events not sentMissing --allow-net permissionRun with --allow-net=o<ORG_ID>.ingest.sentry.io
Deno: deno.land/x/sentry not workingDeprecated and frozen at v8.55.0Switch to npm:@sentry/deno specifier
includeLocalVariables not showing valuesIntegration not activated or minified codeEnsure includeLocalVariables: true in init; check source maps
NestJS: errors not capturedWrong SDK or missing filterUse sentry-nestjs-sdk — NestJS needs @sentry/nestjs, not @sentry/node
Hapi: setupHapiErrorHandler timing issueNot awaitedMust await Sentry.setupHapiErrorHandler(server) before server.start()
Shutdown: events lostProcess exits before flushAdd await Sentry.close(2000) in SIGTERM/SIGINT handler
Stack traces show minified codeSource maps not uploadedConfigure @sentry/cli source map upload in build step
No traces appearing (OTLP)Missing @opentelemetry/* packages or otlpIntegration not addedVerify @opentelemetry/sdk-trace-node is installed; add otlpIntegration() to integrations; do not set tracesSampleRate
OTLP: errors not linked to tracesotlpIntegration not registeredEnsure otlpIntegration() is in the integrations array — it registers the propagation context that links errors to OTel traces
Profiling not starting (OTLP)Profiling requires tracesSampleRateProfiling is not compatible with the OTLP path; use the standard @sentry/node setup instead

© getsentry, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 7 other files (references) in skills-legacy/sentry-node-sdk of getsentry/sentry-for-ai.

  • SKILL.md
  • references/ai-monitoring.md
  • references/crons.md
  • references/error-monitoring.md
  • references/logging.md
  • references/metrics.md
  • references/profiling.md
  • references/tracing.md

Open the folder on GitHubat commit d8fd106

Compare with similar skills

Sentry Node SDK next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Sentry Node SDK compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Sentry Node SDK this skillgetsentry/sentry-for-ai268—~8.4kAutomated safety check: PassApache-2.0
Javascript SDKaiskillstore/marketplace4301 repos~3.3kAutomated safety check: PassNone
Node Backend Development Guidelinesdiet103/claude-code-infrastructure-showcase10k2 repos~2kAutomated safety check: PassMIT
PayRam Checkout IntegrationPayRam/payram-mcp158—~3.4kAutomated safety check: NotesNone
Transformers.jshuggingface/skills11k1 repos~6.2kAutomated safety check: PassApache-2.0
Javascript Typescript Typescript Scaffoldaiskillstore/marketplace4306 repos~2kAutomated safety check: NotesNone

Similar skills

  • Javascript SDK

    aiskillstore/marketplace

    JavaScript/TypeScript SDK for inference.sh - run AI apps, build agents, integrate with all models.

    430 GitHub starsUsed in 1 repo~3.3k tokens
    Backend & APIsAuto-check passed
  • Node Backend Development Guidelines

    diet103/claude-code-infrastructure-showcase

    Sets layered architecture and coding rules for Node.js, Express and TypeScript microservices, covering routes, controllers, services, repositories, Prisma, Sentry and Zod.

    10k GitHub starsUsed in 2 repos~2k tokens
    Backend & APIsAuto-check passed
  • Adds crypto checkout to a web app with PayRam: create a payment from your backend, send the customer to the payment page, then confirm the result.

    158 GitHub stars~3.4k tokensUpdated 1 mo ago
    Backend & APIsAuto-check: notes
  • Transformers.js

    huggingface/skills

    Official

    Runs pre-trained Hugging Face models in JavaScript or TypeScript with Transformers.js, in browsers or Node.js, Bun and Deno, for text, vision, audio and multimodal tasks.

    11k GitHub starsUsed in 1 repo~6.2k tokens
    AI & LLM EngineeringAuto-check passed
  • You are a TypeScript project architecture expert specializing in scaffolding production-ready Node.js and frontend applications.

    430 GitHub starsUsed in 6 repos~2k tokens
    DevelopmentAuto-check: notes
  • Backend Patterns

    hellangleZ/burn-in-cceverywhere-ralph

    Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.

    112 GitHub starsUsed in 17 repos~3.3k tokens
    Backend & APIsAuto-check passed

More from getsentry/sentry-for-ai

All 32 skills in this repo
  • Sentry Elixir SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for Elixir. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~3.5k tokensUpdated today
    Auto-check passed
  • Sentry Go SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for Go. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~3.2k tokensUpdated today
    Auto-check passed
  • Sentry Nextjs SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for Next.js. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~4.7k tokensUpdated today
    Auto-check: notes
  • Sentry Php SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for PHP. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~3.7k tokensUpdated today
    Auto-check: notes
  • Sentry Python SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for Python. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~4.1k tokensUpdated today
    Auto-check passed
  • Sentry React Router Framework SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for React Router Framework mode. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~3.8k tokensUpdated today
    Auto-check: notes

Questions about Sentry Node SDK

What does Sentry Node SDK do?

Full Sentry SDK setup for Node.js, Bun, and Deno. An agent skill from getsentry/sentry-for-ai. Sentry Node SDK is an agent skill from getsentry/sentry-for-ai, published by the product's own GitHub organization.js, Bun, and Deno.

When should I use Sentry Node SDK?

Sentry Node SDK fits situations like: asked to add Sentry to Node.js; add Sentry to Bun; add Sentry to Deno; install @sentry/node.

How do I install Sentry Node SDK in Claude Code?

Run `npx skills add getsentry/sentry-for-ai --skill sentry-node-sdk -a claude-code`. Or copy the skill folder (skills-legacy/sentry-node-sdk in getsentry/sentry-for-ai) into .claude/skills/sentry-node-sdk in your project. Claude Code loads it when a task matches its description.

How do I install Sentry Node SDK in Codex?

Run `npx skills add getsentry/sentry-for-ai --skill sentry-node-sdk -a codex`. Or copy the skill folder (skills-legacy/sentry-node-sdk in getsentry/sentry-for-ai) into .agents/skills/sentry-node-sdk in your project. Codex loads it when a task matches its description.

Can I use Sentry Node SDK in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add getsentry/sentry-for-ai --skill sentry-node-sdk -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sentry-node-sdk, .gemini/skills/sentry-node-sdk, .github/skills/sentry-node-sdk and .opencode/skills/sentry-node-sdk in your project.

What does Sentry Node SDK need to run?

Going by SKILL.md and its folder, Sentry Node SDK needs the command-line tools its instructions call (bun, node, npm, deno, yarn and pnpm) and credentials named SENTRY_AUTH_TOKEN. Our summary lists: Node.js.

Does Sentry Node SDK access the network?

SKILL.md names 2 domains. In commands or code: docs.sentry.io; the agent is likely to contact it when it follows the instructions. As links in the text: sentry.io. This is read from the text; nothing was executed.

Is Sentry Node SDK safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Sentry Node SDK use?

Sentry Node SDK is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Sentry Node SDK use?

About 8.4k tokens (SKILL.md is roughly 34k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 28k tokens, read only when the agent opens those files.

What are the alternatives to Sentry Node SDK?

Skills that share tags, products or a category with Sentry Node SDK: Javascript SDK (aiskillstore/marketplace, 430 stars), Node Backend Development Guidelines (diet103/claude-code-infrastructure-showcase, 10k stars), PayRam Checkout Integration (PayRam/payram-mcp, 158 stars) and Transformers.js (huggingface/skills, 11k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Sentry Node SDK?

getsentry (a GitHub organization, an official publisher) maintains it in getsentry/sentry-for-ai, which has 268 GitHub stars. The repository holds 32 skills in this directory. The repository was last updated on October 7, 2026.

Source: getsentry/sentry-for-ai on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.