
Sentry Nestjs Sdk
Add complete Sentry error monitoring, tracing, and optional logging or crons to a NestJS API without guessing SDK wiring.
Install
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-nestjs-sdkWhat is this skill?
- Opinionated wizard: Phase 1 Detect scans package.json and NestJS version before recommending setup
- Covers @sentry/nestjs 10.x with NestJS 8–11, Express and Fastify adapters, GraphQL, microservices, and WebSockets
- Invoke triggers include add Sentry to NestJS, install @sentry/nestjs, and configure tracing, profiling, logging, metrics
- Child of sentry-sdk-setup in the Sentry for AI skill tree for consistent cross-framework setup
- Points to official docs.sentry.io NestJS guide for version verification before implementing
Adoption & trust: 1.2k installs on skills.sh; 197 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Journey fit
Canonical shelf is Operate because the skill’s payoff is production error visibility, though setup often happens just before or after first deploy. Errors subphase matches Sentry’s core promise—captured exceptions, traces, and profiling for NestJS services in production.
Common Questions / FAQ
Is Sentry Nestjs Sdk safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Sentry Nestjs Sdk
> [All Skills](../../SKILL_TREE.md) > [SDK Setup](../sentry-sdk-setup/SKILL.md) > 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/](https://docs.sentry.io/platforms/node/guides/nestjs/) before implementing. --- ## Phase 1: Detect Run these commands to understand the project before making recommendations: ```bash # 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 dupl