Token导航 LogoToken导航

Agent Skill · 前端设计

sentry-nestjs-sdk(Sentry nestjs SDK 命令行)

sentry-nestjs-sdk 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

sentry-nestjs-sdk 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 672。

总安装 14,690周安装 631GitHub Stars 156下载 5,149核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:sentry-nestjs-sdk(Sentry nestjs SDK 命令行)
来源仓库:https://github.com/getsentry/sentry-for-ai
仓库路径:skills/sentry-nestjs-sdk
安装命令:
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-nestjs-sdk
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-nestjs-sdk

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

用于处理 GitHub 仓库、Issue 和代码协作信息。适合在 NestJS 项目中辅助查询变更历史和协作状态。通过 GitHub 安装后,集成到后端开发流程中。需确保 token 具备对目标仓库的读写权限。sentry-nestjs-sdk 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/sentry-nestjs-sdk

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-nestjs-…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

sentry-nestjs-sdk 怎么安装?

在终端执行 npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-nestjs-sdk。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

sentry-nestjs-sdk 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

sentry-nestjs-sdk 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

sentry-nestjs-sdk 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

sentry-nestjs-sdk 用的人多吗?

公开数据是累计安装 14,690 次,近一周安装 631 次,下载 5,149 次,GitHub 156 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

sentry-nestjs-sdk 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
sentry-nestjs-sdk

Sentry nestjs SDK 命令行 · 本页

14,690156接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

All Skills > SDK Setup > NestJS SDK

Sentry NestJS SDK

Opinionated wizard that scans your NestJS project and guides you through complete Sentry setup.

Invoke This Skill When

  • User asks to "add Sentry to NestJS" or "setup Sentry" in a NestJS app
  • User wants error monitoring, tracing, profiling, logging, metrics, or crons in NestJS
  • User mentions @sentry/nestjs or Sentry + NestJS
  • User wants to monitor NestJS controllers, services, guards, microservices, or background jobs
Note: SDK versions and APIs below reflect @sentry/nestjs 10.x (NestJS 8–11 supported). Always verify against docs.sentry.io/platforms/node/guides/nestjs/ before implementing.

Phase 1: Detect

Run these commands to understand the project before making recommendations:

# Confirm NestJS project
grep -E '"@nestjs/core"' package.json 2>/dev/null

# Check NestJS version
node -e "console.log(require('./node_modules/@nestjs/core/package.json').version)" 2>/dev/null

# Check existing Sentry
grep -i sentry package.json 2>/dev/null
ls src/instrument.ts 2>/dev/null
grep -r "Sentry.init\|@sentry" src/main.ts src/instrument.ts 2>/dev/null

# Check for existing Sentry DI wrapper (common in enterprise NestJS)
grep -rE "SENTRY.*TOKEN|SentryProxy|SentryService" src/ libs/ 2>/dev/null

# Check for config-class-based init (vs env-var-based)
grep -rE "class SentryConfig|SentryConfig" src/ libs/ 2>/dev/null

# Check if SentryModule.forRoot() is already registered in a shared module
grep -rE "SentryModule\.forRoot|SentryProxyModule" src/ libs/ 2>/dev/null

# Detect HTTP adapter (default is Express)
grep -E "FastifyAdapter|@nestjs/platform-fastify" package.json src/main.ts 2>/dev/null

# Detect GraphQL
grep -E '"@nestjs/graphql"|"apollo-server"' package.json 2>/dev/null

# Detect microservices
grep '"@nestjs/microservices"' package.json 2>/dev/null

# Detect WebSockets
grep -E '"@nestjs/websockets"|"socket.io"' package.json 2>/dev/null

# Detect task queues / scheduled jobs
grep -E '"@nestjs/bull"|"@nestjs/bullmq"|"@nestjs/schedule"|"bullmq"|"bull"' package.json 2>/dev/null

# Detect databases
grep -E '"@prisma/client"|"typeorm"|"mongoose"|"pg"|"mysql2"' package.json 2>/dev/null

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

# Check for companion frontend
ls -d ../frontend ../web ../client ../ui 2>/dev/null

What to note:

  • Is @sentry/nestjs already installed? If yes, check if instrument.ts exists and Sentry.init() is called — may just need feature config.
  • Sentry DI wrapper detected? → The project wraps Sentry behind a DI token (e.g. SENTRY_PROXY_TOKEN) for testability. Use the injected proxy for all runtime Sentry calls (startSpan, captureException, withIsolationScope) instead of importing @sentry/nestjs directly in controllers, services, and processors. Only instrument.ts should import @sentry/nestjs directly.
  • Config class detected? → The project uses a typed config class for Sentry.init() options (e.g. loaded from YAML or @nestjs/config). Any new SDK options must be added to the config type — do not hardcode values that should be configurable per environment.
  • SentryModule.forRoot() already registered? → If it's in a shared module (e.g. a Sentry proxy module), do not add it again in AppModule — this causes duplicate interceptor registration.
  • Express (default) or Fastify adapter? Express is fully supported; Fastify works but has known edge cases.
  • GraphQL detected? → SentryGlobalFilter handles it natively.
  • Microservices detected? → Recommend RPC exception filter.
  • Task queues / @nestjs/schedule? → Recommend crons.
  • AI libraries? → Auto-instrumented, zero config.
  • Prisma? → Requires manual prismaIntegration().
  • Companion frontend? → Triggers Phase 4 cross-link.

Phase 2: Recommend

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

Always recommended (core coverage):

  • ✅ Error Monitoring — captures unhandled exceptions across HTTP, GraphQL, RPC, and WebSocket contexts
  • ✅ Tracing — auto-instruments middleware, guards, pipes, interceptors, filters, and route handlers

Recommend when detected:

  • ✅ Profiling — production apps where CPU performance matters (@sentry/profiling-node)
  • ✅ Logging — structured Sentry Logs + optional console capture
  • ✅ Crons — @nestjs/schedule, Bull, or BullMQ detected
  • ✅ Metrics — business KPIs or SLO tracking
  • ✅ AI Monitoring — OpenAI/Anthropic/LangChain/etc. detected (auto-instrumented, zero config)

Recommendation matrix:

FeatureRecommend when...Reference
Error MonitoringAlways — non-negotiable baseline${SKILL_ROOT}/references/error-monitoring.md
TracingAlways — NestJS lifecycle is auto-instrumented${SKILL_ROOT}/references/tracing.md
ProfilingProduction + CPU-sensitive workloads${SKILL_ROOT}/references/profiling.md
LoggingAlways; enhanced for structured log aggregation${SKILL_ROOT}/references/logging.md
MetricsCustom business KPIs or SLO tracking${SKILL_ROOT}/references/metrics.md
Crons@nestjs/schedule, Bull, or BullMQ detected${SKILL_ROOT}/references/crons.md
AI MonitoringOpenAI/Anthropic/LangChain/etc. detected${SKILL_ROOT}/references/ai-monitoring.md

Propose: *"I recommend Error Monitoring + Tracing + Logging. Want Profiling, Crons, or AI Monitoring too?"*


Phase 3: Guide

Install

# Core SDK (always required — includes @sentry/node)
npm install @sentry/nestjs

# With profiling support (optional)
npm install @sentry/nestjs @sentry/profiling-node
⚠️ Do NOT install @sentry/node alongside @sentry/nestjs — @sentry/nestjs re-exports everything from @sentry/node. Installing both causes duplicate registration.

Three-File Setup (Required)

NestJS requires a specific three-file initialization pattern because the Sentry SDK must patch Node.js modules (via OpenTelemetry) before NestJS loads them.

Before creating new files, check Phase 1 results: - If instrument.ts already exists → modify it, don't create a new one. - If a config class drives Sentry.init() → read options from the config instead of hardcoding env vars. - If a Sentry DI wrapper exists → use it for runtime calls instead of importing @sentry/nestjs directly in services/controllers.
Step 1: Create src/instrument.ts
import * as Sentry from "@sentry/nestjs";
// Optional: add profiling
// import { nodeProfilingIntegration } from "@sentry/profiling-node";

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  environment: process.env.SENTRY_ENVIRONMENT ?? "production",
  release: process.env.SENTRY_RELEASE,
  sendDefaultPii: true,

  // Tracing — lower to 0.1–0.2 in high-traffic production
  tracesSampleRate: 1.0,

  // Profiling (requires @sentry/profiling-node)
  // integrations: [nodeProfilingIntegration()],
  // profileSessionSampleRate: 1.0,
  // profileLifecycle: "trace",

  // Structured logs (SDK ≥ 9.41.0)
  enableLogs: true,
});

Config-driven Sentry.init(): If Phase 1 found a typed config class (e.g. SentryConfig), read options from it instead of using raw process.env. This is common in NestJS apps that use @nestjs/config or custom config loaders:

import * as Sentry from "@sentry/nestjs";
import { loadConfiguration } from "./config";

const config = loadConfiguration();

Sentry.init({
  dsn: config.sentry.dsn,
  environment: config.sentry.environment ?? "production",
  release: config.sentry.release,
  sendDefaultPii: config.sentry.sendDefaultPii ?? true,
  tracesSampleRate: config.sentry.tracesSampleRate ?? 1.0,
  profileSessionSampleRate: config.sentry.profilesSampleRate ?? 1.0,
  profileLifecycle: "trace",
  enableLogs: true,
});

When adding new SDK options (e.g. sendDefaultPii, profileSessionSampleRate), add them to the config type so they can be configured per environment.

Step 2: Import instrument.ts FIRST in src/main.ts
// instrument.ts MUST be the very first import — before NestJS or any other module
import "./instrument";

import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  // Enable graceful shutdown — flushes Sentry events on SIGTERM/SIGINT
  app.enableShutdownHooks();

  await app.listen(3000);
}
bootstrap();
Why first? OpenTelemetry must monkey-patch http, express, database drivers, and other modules before they load. Any module that loads before instrument.ts will not be auto-instrumented.
Step 3: Register SentryModule and SentryGlobalFilter in src/app.module.ts
import { Module } from "@nestjs/common";
import { APP_FILTER } from "@nestjs/core";
import { SentryModule, SentryGlobalFilter } from "@sentry/nestjs/setup";
import { AppController } from "./app.controller";
import { AppService } from "./app.service";

@Module({
  imports: [
    SentryModule.forRoot(), // Registers SentryTracingInterceptor globally
  ],
  controllers: [AppController],
  providers: [
    AppService,
    {
      provide: APP_FILTER,
      useClass: SentryGlobalFilter, // Captures all unhandled exceptions
    },
  ],
})
export class AppModule {}

What each piece does:

  • SentryModule.forRoot() — registers SentryTracingInterceptor as a global APP_INTERCEPTOR, enabling HTTP transaction naming
  • SentryGlobalFilter — extends BaseExceptionFilter; captures exceptions across HTTP, GraphQL (rethrows HttpException without reporting), and RPC contexts
⚠️ Do NOT register SentryModule.forRoot() twice. If Phase 1 found it already imported in a shared library module (e.g. a SentryProxyModule or AnalyticsModule), do not add it again in AppModule. Duplicate registration causes every span to be intercepted twice, bloating trace data.
⚠️ Two entrypoints, different imports: - @sentry/nestjs → SDK init, capture APIs, decorators (SentryTraced, SentryCron, SentryExceptionCaptured) - @sentry/nestjs/setup → NestJS DI constructs (SentryModule, SentryGlobalFilter) Never import SentryModule from @sentry/nestjs (main entrypoint) — it loads @nestjs/common before OpenTelemetry patches it, breaking auto-instrumentation.

ESM Setup (Node ≥ 18.19.0)

For ESM applications, use --import instead of a file import:

// instrument.mjs
import * as Sentry from "@sentry/nestjs";

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  tracesSampleRate: 1.0,
});
// package.json
{
  "scripts": {
    "start": "node --import ./instrument.mjs -r ts-node/register src/main.ts"
  }
}

Or via environment:

NODE_OPTIONS="--import ./instrument.mjs" npm run start

Exception Filter Options

Choose the approach that fits your existing architecture:

Option A: No existing global filter — use SentryGlobalFilter (recommended)

Already covered in Step 3 above. This is the simplest option.

Option B: Existing custom global filter — add @SentryExceptionCaptured() decorator
import { Catch, ExceptionFilter, ArgumentsHost } from "@nestjs/common";
import { SentryExceptionCaptured } from "@sentry/nestjs";

@Catch()
export class YourExistingFilter implements ExceptionFilter {
  @SentryExceptionCaptured() // Wraps catch() to auto-report exceptions
  catch(exception: unknown, host: ArgumentsHost): void {
    // Your existing error handling continues unchanged
  }
}
Option C: Specific exception type — manual capture
import { ArgumentsHost, Catch } from "@nestjs/common";
import { BaseExceptionFilter } from "@nestjs/core";
import * as Sentry from "@sentry/nestjs";

@Catch(ExampleException)
export class ExampleExceptionFilter extends BaseExceptionFilter {
  catch(exception: ExampleException, host: ArgumentsHost) {
    Sentry.captureException(exception);
    super.catch(exception, host);
  }
}
Option D: Microservice RPC exceptions
import { Catch, RpcExceptionFilter, ArgumentsHost } from "@nestjs/common";
import { Observable, throwError } from "rxjs";
import { RpcException } from "@nestjs/microservices";
import * as Sentry from "@sentry/nestjs";

@Catch(RpcException)
export class SentryRpcFilter implements RpcExceptionFilter<RpcException> {
  catch(exception: RpcException, host: ArgumentsHost): Observable<any> {
    Sentry.captureException(exception);
    return throwError(() => exception.getError());
  }
}

Decorators

@SentryTraced(op?) — Instrument any method
import { Injectable } from "@nestjs/common";
import { SentryTraced } from "@sentry/nestjs";

@Injectable()
export class OrderService {
  @SentryTraced("order.process")
  async processOrder(orderId: string): Promise<void> {
    // Automatically wrapped in a Sentry span
  }

  @SentryTraced()  // Defaults to op: "function"
  async fetchInventory() { ... }
}
@SentryCron(slug, config?) — Monitor scheduled jobs
import { Injectable } from "@nestjs/common";
import { Cron } from "@nestjs/schedule";
import { SentryCron } from "@sentry/nestjs";

@Injectable()
export class ReportService {
  @Cron("0 * * * *")
  @SentryCron("hourly-report", {
    // @SentryCron must come AFTER @Cron
    schedule: { type: "crontab", value: "0 * * * *" },
    checkinMargin: 2, // Minutes before marking missed
    maxRuntime: 10, // Max runtime in minutes
    timezone: "UTC",
  })
  async generateReport() {
    // Check-in sent automatically on start/success/failure
  }
}
Background Job Scope Isolation

Background jobs share the default isolation scope — wrap with Sentry.withIsolationScope() to prevent cross-contamination:

import * as Sentry from "@sentry/nestjs";
import { Injectable } from "@nestjs/common";
import { Cron, CronExpression } from "@nestjs/schedule";

@Injectable()
export class JobService {
  @Cron(CronExpression.EVERY_HOUR)
  handleCron() {
    Sentry.withIsolationScope(() => {
      Sentry.setTag("job", "hourly-sync");
      this.doWork();
    });
  }
}

Apply withIsolationScope to: @Cron(), @Interval(), @OnEvent(), @Processor(), and any code outside the request lifecycle.

Working with Sentry DI Wrappers

Some NestJS projects wrap Sentry behind a dependency injection token (e.g. SENTRY_PROXY_TOKEN) for testability and decoupling. If Phase 1 detected this pattern, use the injected service for all runtime Sentry calls — do not import @sentry/nestjs directly in controllers, services, or processors.

import { Controller, Inject } from "@nestjs/common";
import { SENTRY_PROXY_TOKEN, type SentryProxyService } from "./sentry-proxy";

@Controller("orders")
export class OrderController {
  constructor(
    @Inject(SENTRY_PROXY_TOKEN) private readonly sentry: SentryProxyService,
    private readonly orderService: OrderService,
  ) {}

  @Post()
  async createOrder(@Body() dto: CreateOrderDto) {
    return this.sentry.startSpan(
      { name: "createOrder", op: "http" },
      async () => this.orderService.create(dto),
    );
  }
}

Where direct @sentry/nestjs import is still correct:

  • instrument.ts — always uses import * as Sentry from "@sentry/nestjs" for Sentry.init()
  • Standalone scripts and exception filters that run outside the DI container

Verification

Add a test endpoint to confirm events reach Sentry:

import { Controller, Get } from "@nestjs/common";
import * as Sentry from "@sentry/nestjs";

@Controller()
export class DebugController {
  @Get("/debug-sentry")
  triggerError() {
    throw new Error("My first Sentry error from NestJS!");
  }

  @Get("/debug-sentry-span")
  triggerSpan() {
    return Sentry.startSpan({ op: "test", name: "NestJS Test Span" }, () => {
      return { status: "span created" };
    });
  }
}

Hit GET /debug-sentry and check the Sentry Issues dashboard within seconds.

For Each Agreed Feature

Walk through features one at a time. Load the reference, follow its steps, verify before moving on:

FeatureReference fileLoad when...
Error Monitoring${SKILL_ROOT}/references/error-monitoring.mdAlways (baseline)
Tracing${SKILL_ROOT}/references/tracing.mdAlways (NestJS routes are auto-traced)
Profiling${SKILL_ROOT}/references/profiling.mdCPU-intensive production apps
Logging${SKILL_ROOT}/references/logging.mdStructured log aggregation needed
Metrics${SKILL_ROOT}/references/metrics.mdCustom KPIs / SLO tracking
Crons${SKILL_ROOT}/references/crons.mdScheduled jobs or task queues
AI Monitoring${SKILL_ROOT}/references/ai-monitoring.mdOpenAI/Anthropic/LangChain detected

For each feature: Read ${SKILL_ROOT}/references/<feature>.md, follow steps exactly, verify it works.


Configuration Reference

Key Sentry.init() Options

OptionTypeDefaultPurpose
dsnstring—SDK disabled if empty; env: SENTRY_DSN
environmentstring"production"e.g., "staging"; env: SENTRY_ENVIRONMENT
releasestring—e.g., "myapp@1.0.0"; env: SENTRY_RELEASE
sendDefaultPiibooleanfalseInclude IP addresses and request headers
tracesSampleRatenumber—Transaction sample rate; undefined disables tracing
tracesSamplerfunction—Custom per-transaction sampling (overrides rate)
tracePropagationTargets`Array<string\RegExp>`—URLs to propagate sentry-trace/baggage headers to
profileSessionSampleRatenumber—Continuous profiling session rate (SDK ≥ 10.27.0)
profileLifecycle`"trace"\"manual"`"trace""trace" = auto-start profiler with spans; "manual" = call startProfiler()/stopProfiler()
enableLogsbooleanfalseSend structured logs to Sentry (SDK ≥ 9.41.0)
ignoreErrors`Array<string\RegExp>`[]Error message patterns to suppress
ignoreTransactions`Array<string\RegExp>`[]Transaction name patterns to suppress
beforeSendfunction—Hook to mutate or drop error events
beforeSendTransactionfunction—Hook to mutate or drop transaction events
beforeSendLogfunction—Hook to mutate or drop log events
debugbooleanfalseVerbose SDK debug output
maxBreadcrumbsnumber100Max breadcrumbs per event

Environment Variables

VariableMaps toNotes
SENTRY_DSNdsnUsed if dsn not passed to init()
SENTRY_RELEASEreleaseAlso auto-detected from git SHA, Heroku, CircleCI
SENTRY_ENVIRONMENTenvironmentFalls back to "production"
SENTRY_AUTH_TOKENCLI/source mapsFor npx @sentry/wizard@latest -i sourcemaps
SENTRY_ORGCLI/source mapsOrganization slug
SENTRY_PROJECTCLI/source mapsProject slug

Auto-Enabled Integrations

These integrations activate automatically when their packages are detected — no integrations: [...] needed:

Auto-enabledNotes
httpIntegrationOutgoing HTTP calls via http/https/fetch
expressIntegrationExpress adapter (default NestJS)
nestIntegrationNestJS lifecycle (middleware, guards, pipes, interceptors, handlers)
onUncaughtExceptionIntegrationUncaught exceptions
onUnhandledRejectionIntegrationUnhandled promise rejections
openAIIntegrationOpenAI SDK (when installed)
anthropicAIIntegrationAnthropic SDK (when installed)
langchainIntegrationLangChain (when installed)
graphqlIntegrationGraphQL (when graphql package present)
postgresIntegrationpg driver
mysqlIntegrationmysql / mysql2
mongoIntegrationMongoDB / Mongoose
redisIntegrationioredis / redis

Integrations Requiring Manual Setup

IntegrationWhen to addCode
nodeProfilingIntegrationProfiling desiredimport {nodeProfilingIntegration} from "@sentry/profiling-node"
prismaIntegrationPrisma ORM usedintegrations: [Sentry.prismaIntegration()]
consoleLoggingIntegrationCapture console outputintegrations: [Sentry.consoleLoggingIntegration()]
localVariablesIntegrationCapture local var values in errorsintegrations: [Sentry.localVariablesIntegration()]

Verification

Test that Sentry is receiving events:

// Add a test endpoint (remove before production)
@Get("/debug-sentry")
getError() {
  throw new Error("My first Sentry error!");
}

Or send a test message without crashing:

import * as Sentry from "@sentry/nestjs";
Sentry.captureMessage("NestJS Sentry SDK test");

If nothing appears:

  1. Set debug: true in Sentry.init() — prints SDK internals to stdout
  2. Verify SENTRY_DSN env var is set in the running process
  3. Check that import "./instrument" is the first line in main.ts
  4. Confirm SentryModule.forRoot() is imported in AppModule
  5. Check DSN format: https://<key>@o<org>.ingest.sentry.io/<project>

Phase 4: Cross-Link

After completing NestJS setup, check for a companion frontend missing Sentry:

ls -d ../frontend ../web ../client ../ui 2>/dev/null
cat ../frontend/package.json ../web/package.json 2>/dev/null \
  | grep -E '"react"|"svelte"|"vue"|"next"|"nuxt"'

If a frontend exists without Sentry, suggest the matching skill:

Frontend detectedSuggest skill
Next.jssentry-nextjs-sdk
Reactsentry-react-sdk
Svelte / SvelteKitsentry-svelte-sdk
Vue / NuxtUse @sentry/vue — see docs.sentry.io/platforms/javascript/guides/vue/
React Native / Exposentry-react-native-sdk

Troubleshooting

IssueSolution
Events not appearingSet debug: true, verify SENTRY_DSN, check instrument.ts is imported first
Malformed DSN errorFormat: https://<key>@o<org>.ingest.sentry.io/<project>
Exceptions not capturedEnsure SentryGlobalFilter is registered via APP_FILTER in AppModule
Auto-instrumentation not workinginstrument.ts must be the first import in main.ts — before all NestJS imports
Profiling not startingRequires tracesSampleRate > 0 + profileSessionSampleRate > 0 + @sentry/profiling-node installed
enableLogs not workingRequires SDK ≥ 9.41.0
No traces appearingVerify tracesSampleRate is set (not undefined)
Too many transactionsLower tracesSampleRate or use tracesSampler to drop health checks
Fastify + GraphQL issuesKnown edge cases — see GitHub #13388; prefer Express for GraphQL
Background job events mixedWrap job body in Sentry.withIsolationScope(() => {...})
Prisma spans missingAdd integrations: [Sentry.prismaIntegration()] to Sentry.init()
ESM syntax errorsSet registerEsmLoaderHooks: false (disables ESM hooks; also disables auto-instrumentation for ESM modules)
SentryModule breaks instrumentationMust import from @sentry/nestjs/setup, never from @sentry/nestjs
RPC exceptions not capturedAdd dedicated SentryRpcExceptionFilter (see Option D in exception filter section)
WebSocket exceptions not capturedUse @SentryExceptionCaptured() on gateway handleConnection/handleDisconnect
@SentryCron not triggeringDecorator order matters — @SentryCron MUST come after @Cron
TypeScript path alias issuesEnsure tsconfig.json paths are configured so instrument resolves from main.ts location
import * as Sentry ESLint errorMany projects ban namespace imports. Use named imports (import {startSpan, captureException} from "@sentry/nestjs") or use the project's DI proxy instead
profilesSampleRate vs profileSessionSampleRateprofilesSampleRate is deprecated in SDK 10.x. Use profileSessionSampleRate + profileLifecycle: "trace" instead
Duplicate spans on every requestSentryModule.forRoot() registered in multiple modules. Ensure it's only called once — check shared/library modules
Config property not recognized in instrument.tsWhen using a typed config class, new SDK options must be added to the config type definition and the project rebuilt before TypeScript recognizes them

Version Requirements

FeatureMinimum SDK Version
@sentry/nestjs package8.0.0
@SentryTraced decorator8.15.0
@SentryCron decorator8.16.0
Event Emitter auto-instrumentation8.39.0
SentryGlobalFilter (unified)8.40.0
Sentry.logger API (enableLogs)9.41.0
profileSessionSampleRate10.27.0
Node.js requirement≥ 18
Node.js for ESM --import≥ 18.19.0
NestJS compatibility8.x – 11.x

平台分布

Codex

37.14%
按下载量换算1,912

Claude

26.84%
按下载量换算1,382

Cursor

16.6%
按下载量换算855

Gemini CLI

9.55%
按下载量换算492

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills