@danieljvdm/dev-kit 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +1 -1
- package/skill-sources.jsonc +6 -29
- package/skill-sources.lock.json +23 -109
- package/skills/animate/LICENSE +21 -0
- package/skills/animate/NOTICE +10 -0
- package/skills/animate/SKILL.md +34 -0
- package/skills/animate/references/gestures.md +27 -0
- package/skills/animate/references/glossary.md +136 -0
- package/skills/animate/references/implementation.md +22 -0
- package/skills/animate/references/opportunities.md +18 -0
- package/skills/animate/references/principles.md +48 -0
- package/skills/animate/references/review.md +19 -0
- package/skills/cloudflare-workers/LICENSE +202 -0
- package/skills/cloudflare-workers/NOTICE +9 -0
- package/skills/cloudflare-workers/SKILL.md +26 -0
- package/skills/cloudflare-workers/references/durable-objects.md +68 -0
- package/skills/cloudflare-workers/references/sandbox.md +48 -0
- package/skills/cloudflare-workers/references/workers.md +63 -0
- package/skills/cloudflare-workers/references/wrangler.md +56 -0
- package/skills/design-ui/LICENSE +21 -0
- package/skills/design-ui/NOTICE +8 -0
- package/skills/design-ui/SKILL.md +29 -0
- package/skills/design-ui/references/appearance.md +22 -0
- package/skills/design-ui/references/components.md +33 -0
- package/skills/design-ui/references/exploration.md +50 -0
- package/skills/design-ui/references/libraries.md +39 -0
- package/skills/design-ui/references/themes.md +23 -0
- package/skills/dev-kit/SKILL.md +19 -38
- package/skills/dev-kit/references/cloudflare-worker-api.md +1 -1
- package/skills/dev-kit/references/skills.md +2 -2
- package/skills/effect-development/SKILL.md +27 -0
- package/skills/effect-development/agents/openai.yaml +4 -0
- package/skills/effect-development/references/api/index.md +32 -0
- package/skills/effect-development/references/api/schema-codecs.md +15 -0
- package/skills/{build-effect-apis/references → effect-development/references/api}/verification.md +10 -5
- package/skills/{effect-architecture-audit/SKILL.md → effect-development/references/architecture/index.md} +1 -6
- package/skills/{effect-atom-state/references → effect-development/references/atom}/effect-atom-client.md +8 -6
- package/skills/{effect-atom-state/references → effect-development/references/atom}/effect-atom-testing.md +7 -2
- package/skills/effect-development/references/atom/index.md +40 -0
- package/skills/{build-effect-clis/references → effect-development/references/cli}/entrypoints-and-testing.md +6 -2
- package/skills/effect-development/references/cli/index.md +39 -0
- package/skills/effect-development/references/setup.md +15 -0
- package/skills/open-pull-request/SKILL.md +11 -115
- package/skills/open-pull-request/agents/openai.yaml +3 -3
- package/skills/open-pull-request/references/evidence.md +22 -0
- package/skills/open-pull-request/references/explanation.md +21 -0
- package/skills/open-pull-request/references/publication.md +21 -0
- package/skills/sentry/LICENSE +202 -0
- package/skills/sentry/LICENSE-UPSTREAM +21 -0
- package/skills/sentry/NOTICE +14 -0
- package/skills/sentry/SKILL.md +33 -0
- package/skills/sentry/references/alert-payloads.md +105 -0
- package/skills/sentry/references/alerts.md +17 -0
- package/skills/sentry/references/artifacts.md +25 -0
- package/skills/sentry/references/auth-token.md +65 -0
- package/skills/sentry/references/concepts/ai-monitoring.md +131 -0
- package/skills/sentry/references/concepts/choosing-a-signal.md +78 -0
- package/skills/sentry/references/concepts/crons.md +50 -0
- package/skills/sentry/references/concepts/data-scrubbing.md +43 -0
- package/skills/sentry/references/concepts/errors.md +40 -0
- package/skills/sentry/references/concepts/logging.md +85 -0
- package/skills/sentry/references/concepts/metrics.md +49 -0
- package/skills/sentry/references/concepts/monitors.md +78 -0
- package/skills/sentry/references/concepts/profiling.md +38 -0
- package/skills/sentry/references/concepts/reduce-volume.md +49 -0
- package/skills/sentry/references/concepts/releases.md +43 -0
- package/skills/sentry/references/concepts/session-replay.md +35 -0
- package/skills/sentry/references/concepts/tracing.md +54 -0
- package/skills/sentry/references/concepts/user-feedback.md +36 -0
- package/skills/sentry/references/debug-artifacts/android.md +68 -0
- package/skills/sentry/references/debug-artifacts/apple.md +96 -0
- package/skills/sentry/references/debug-artifacts/dotnet.md +70 -0
- package/skills/sentry/references/debug-artifacts/flutter.md +65 -0
- package/skills/sentry/references/debug-artifacts/index.md +75 -0
- package/skills/sentry/references/debug-artifacts/javascript.md +94 -0
- package/skills/sentry/references/debug-artifacts/matching.md +73 -0
- package/skills/sentry/references/debug-artifacts/react-native.md +75 -0
- package/skills/sentry/references/first-error-setup.md +25 -0
- package/skills/sentry/references/instrumentation.md +30 -0
- package/skills/sentry/references/issues.md +32 -0
- package/skills/sentry/references/new-project.md +17 -0
- package/skills/sentry/references/otel-exporter.md +30 -0
- package/skills/sentry/references/release-workflow.md +31 -0
- package/skills/sentry/references/releases/ci-pipeline.md +214 -0
- package/skills/sentry/references/releases/index.md +93 -0
- package/skills/sentry/references/releases/suspect-commits.md +155 -0
- package/skills/sentry/references/releases/tagging.md +131 -0
- package/skills/sentry/references/releases/troubleshooting.md +67 -0
- package/skills/sentry/references/sdks/android/crons.md +305 -0
- package/skills/sentry/references/sdks/android/error-monitoring.md +800 -0
- package/skills/sentry/references/sdks/android/index.md +748 -0
- package/skills/sentry/references/sdks/android/integrations.md +48 -0
- package/skills/sentry/references/sdks/android/logging.md +374 -0
- package/skills/sentry/references/sdks/android/metrics.md +288 -0
- package/skills/sentry/references/sdks/android/profiling.md +397 -0
- package/skills/sentry/references/sdks/android/session-replay.md +406 -0
- package/skills/sentry/references/sdks/android/tracing.md +861 -0
- package/skills/sentry/references/sdks/browser/error-monitoring.md +861 -0
- package/skills/sentry/references/sdks/browser/index.md +714 -0
- package/skills/sentry/references/sdks/browser/logging.md +315 -0
- package/skills/sentry/references/sdks/browser/profiling.md +236 -0
- package/skills/sentry/references/sdks/browser/session-replay.md +586 -0
- package/skills/sentry/references/sdks/browser/tracing.md +561 -0
- package/skills/sentry/references/sdks/browser/user-feedback.md +354 -0
- package/skills/sentry/references/sdks/cloudflare/ai-monitoring.md +661 -0
- package/skills/sentry/references/sdks/cloudflare/crons.md +231 -0
- package/skills/sentry/references/sdks/cloudflare/durable-objects.md +381 -0
- package/skills/sentry/references/sdks/cloudflare/error-monitoring.md +329 -0
- package/skills/sentry/references/sdks/cloudflare/index.md +698 -0
- package/skills/sentry/references/sdks/cloudflare/logging.md +169 -0
- package/skills/sentry/references/sdks/cloudflare/nodejs-compat.md +134 -0
- package/skills/sentry/references/sdks/cloudflare/tracing.md +475 -0
- package/skills/sentry/references/sdks/cocoa/error-monitoring.md +394 -0
- package/skills/sentry/references/sdks/cocoa/index.md +497 -0
- package/skills/sentry/references/sdks/cocoa/logging.md +209 -0
- package/skills/sentry/references/sdks/cocoa/metrics.md +136 -0
- package/skills/sentry/references/sdks/cocoa/profiling.md +223 -0
- package/skills/sentry/references/sdks/cocoa/session-replay.md +257 -0
- package/skills/sentry/references/sdks/cocoa/tracing.md +524 -0
- package/skills/sentry/references/sdks/cocoa/user-feedback.md +310 -0
- package/skills/sentry/references/sdks/dotnet/crons.md +465 -0
- package/skills/sentry/references/sdks/dotnet/error-monitoring.md +1100 -0
- package/skills/sentry/references/sdks/dotnet/index.md +614 -0
- package/skills/sentry/references/sdks/dotnet/logging.md +556 -0
- package/skills/sentry/references/sdks/dotnet/metrics.md +229 -0
- package/skills/sentry/references/sdks/dotnet/profiling.md +296 -0
- package/skills/sentry/references/sdks/dotnet/tracing.md +897 -0
- package/skills/sentry/references/sdks/elixir/crons.md +371 -0
- package/skills/sentry/references/sdks/elixir/error-monitoring.md +335 -0
- package/skills/sentry/references/sdks/elixir/index.md +383 -0
- package/skills/sentry/references/sdks/elixir/logging.md +239 -0
- package/skills/sentry/references/sdks/elixir/tracing.md +233 -0
- package/skills/sentry/references/sdks/flutter/ecosystem-integrations.md +70 -0
- package/skills/sentry/references/sdks/flutter/error-monitoring.md +312 -0
- package/skills/sentry/references/sdks/flutter/index.md +728 -0
- package/skills/sentry/references/sdks/flutter/logging.md +387 -0
- package/skills/sentry/references/sdks/flutter/metrics.md +310 -0
- package/skills/sentry/references/sdks/flutter/profiling.md +214 -0
- package/skills/sentry/references/sdks/flutter/session-replay.md +308 -0
- package/skills/sentry/references/sdks/flutter/tracing.md +502 -0
- package/skills/sentry/references/sdks/go/crons.md +270 -0
- package/skills/sentry/references/sdks/go/error-monitoring.md +361 -0
- package/skills/sentry/references/sdks/go/index.md +324 -0
- package/skills/sentry/references/sdks/go/logging.md +354 -0
- package/skills/sentry/references/sdks/go/metrics.md +273 -0
- package/skills/sentry/references/sdks/go/profiling.md +46 -0
- package/skills/sentry/references/sdks/go/tracing.md +366 -0
- package/skills/sentry/references/sdks/index.md +41 -0
- package/skills/sentry/references/sdks/nestjs/ai-monitoring.md +410 -0
- package/skills/sentry/references/sdks/nestjs/crons.md +268 -0
- package/skills/sentry/references/sdks/nestjs/error-monitoring.md +729 -0
- package/skills/sentry/references/sdks/nestjs/index.md +699 -0
- package/skills/sentry/references/sdks/nestjs/logging.md +174 -0
- package/skills/sentry/references/sdks/nestjs/metrics.md +243 -0
- package/skills/sentry/references/sdks/nestjs/profiling.md +127 -0
- package/skills/sentry/references/sdks/nestjs/tracing.md +762 -0
- package/skills/sentry/references/sdks/nextjs/ai-monitoring.md +494 -0
- package/skills/sentry/references/sdks/nextjs/crons.md +383 -0
- package/skills/sentry/references/sdks/nextjs/error-monitoring.md +974 -0
- package/skills/sentry/references/sdks/nextjs/index.md +491 -0
- package/skills/sentry/references/sdks/nextjs/logging.md +381 -0
- package/skills/sentry/references/sdks/nextjs/metrics.md +411 -0
- package/skills/sentry/references/sdks/nextjs/profiling.md +403 -0
- package/skills/sentry/references/sdks/nextjs/session-replay.md +462 -0
- package/skills/sentry/references/sdks/nextjs/tracing.md +628 -0
- package/skills/sentry/references/sdks/node/ai-monitoring.md +303 -0
- package/skills/sentry/references/sdks/node/crons.md +432 -0
- package/skills/sentry/references/sdks/node/error-monitoring.md +1125 -0
- package/skills/sentry/references/sdks/node/index.md +942 -0
- package/skills/sentry/references/sdks/node/logging.md +380 -0
- package/skills/sentry/references/sdks/node/metrics.md +278 -0
- package/skills/sentry/references/sdks/node/profiling.md +373 -0
- package/skills/sentry/references/sdks/node/tracing.md +878 -0
- package/skills/sentry/references/sdks/php/ai-monitoring.md +310 -0
- package/skills/sentry/references/sdks/php/crons.md +265 -0
- package/skills/sentry/references/sdks/php/error-monitoring.md +626 -0
- package/skills/sentry/references/sdks/php/index.md +362 -0
- package/skills/sentry/references/sdks/php/laravel.md +542 -0
- package/skills/sentry/references/sdks/php/logging.md +242 -0
- package/skills/sentry/references/sdks/php/metrics.md +193 -0
- package/skills/sentry/references/sdks/php/profiling.md +115 -0
- package/skills/sentry/references/sdks/php/symfony.md +552 -0
- package/skills/sentry/references/sdks/php/tracing.md +516 -0
- package/skills/sentry/references/sdks/python/ai-monitoring.md +351 -0
- package/skills/sentry/references/sdks/python/crons.md +218 -0
- package/skills/sentry/references/sdks/python/error-monitoring.md +292 -0
- package/skills/sentry/references/sdks/python/index.md +361 -0
- package/skills/sentry/references/sdks/python/logging.md +234 -0
- package/skills/sentry/references/sdks/python/metrics.md +154 -0
- package/skills/sentry/references/sdks/python/profiling.md +120 -0
- package/skills/sentry/references/sdks/python/tracing.md +364 -0
- package/skills/sentry/references/sdks/react/error-monitoring.md +1607 -0
- package/skills/sentry/references/sdks/react/index.md +492 -0
- package/skills/sentry/references/sdks/react/logging.md +364 -0
- package/skills/sentry/references/sdks/react/profiling.md +322 -0
- package/skills/sentry/references/sdks/react/react-features.md +1272 -0
- package/skills/sentry/references/sdks/react/session-replay.md +1193 -0
- package/skills/sentry/references/sdks/react/tracing.md +1415 -0
- package/skills/sentry/references/sdks/react-native/error-monitoring.md +1481 -0
- package/skills/sentry/references/sdks/react-native/expo-config-plugin.md +45 -0
- package/skills/sentry/references/sdks/react-native/index.md +1030 -0
- package/skills/sentry/references/sdks/react-native/logging.md +444 -0
- package/skills/sentry/references/sdks/react-native/profiling.md +386 -0
- package/skills/sentry/references/sdks/react-native/session-replay.md +704 -0
- package/skills/sentry/references/sdks/react-native/tracing.md +1086 -0
- package/skills/sentry/references/sdks/react-native/user-feedback.md +815 -0
- package/skills/sentry/references/sdks/react-router-framework/error-monitoring.md +127 -0
- package/skills/sentry/references/sdks/react-router-framework/index.md +411 -0
- package/skills/sentry/references/sdks/react-router-framework/logging.md +66 -0
- package/skills/sentry/references/sdks/react-router-framework/profiling.md +57 -0
- package/skills/sentry/references/sdks/react-router-framework/react-router-framework-features.md +110 -0
- package/skills/sentry/references/sdks/react-router-framework/session-replay.md +67 -0
- package/skills/sentry/references/sdks/react-router-framework/tracing.md +96 -0
- package/skills/sentry/references/sdks/react-router-framework/user-feedback.md +71 -0
- package/skills/sentry/references/sdks/ruby/crons.md +184 -0
- package/skills/sentry/references/sdks/ruby/error-monitoring.md +248 -0
- package/skills/sentry/references/sdks/ruby/index.md +297 -0
- package/skills/sentry/references/sdks/ruby/logging.md +168 -0
- package/skills/sentry/references/sdks/ruby/metrics.md +196 -0
- package/skills/sentry/references/sdks/ruby/migration.md +321 -0
- package/skills/sentry/references/sdks/ruby/profiling.md +107 -0
- package/skills/sentry/references/sdks/ruby/tracing.md +388 -0
- package/skills/sentry/references/sdks/svelte/error-monitoring.md +456 -0
- package/skills/sentry/references/sdks/svelte/index.md +467 -0
- package/skills/sentry/references/sdks/svelte/logging.md +344 -0
- package/skills/sentry/references/sdks/svelte/session-replay.md +369 -0
- package/skills/sentry/references/sdks/svelte/tracing.md +406 -0
- package/skills/sentry/references/sdks/tanstack-start/error-monitoring.md +149 -0
- package/skills/sentry/references/sdks/tanstack-start/index.md +381 -0
- package/skills/sentry/references/sdks/tanstack-start/logging.md +74 -0
- package/skills/sentry/references/sdks/tanstack-start/session-replay.md +76 -0
- package/skills/sentry/references/sdks/tanstack-start/tanstackstart-features.md +128 -0
- package/skills/sentry/references/sdks/tanstack-start/tracing.md +123 -0
- package/skills/sentry/references/sdks/tanstack-start/user-feedback.md +81 -0
- package/skills/sentry/references/search-query-language.md +226 -0
- package/skills/sentry/references/semantics/angular.md +7 -0
- package/skills/sentry/references/semantics/app.md +28 -0
- package/skills/sentry/references/semantics/art.md +17 -0
- package/skills/sentry/references/semantics/aws.md +43 -0
- package/skills/sentry/references/semantics/browser.md +34 -0
- package/skills/sentry/references/semantics/cache.md +12 -0
- package/skills/sentry/references/semantics/client.md +8 -0
- package/skills/sentry/references/semantics/cloud.md +12 -0
- package/skills/sentry/references/semantics/cloudflare.md +23 -0
- package/skills/sentry/references/semantics/code.md +11 -0
- package/skills/sentry/references/semantics/culture.md +11 -0
- package/skills/sentry/references/semantics/db.md +21 -0
- package/skills/sentry/references/semantics/device.md +43 -0
- package/skills/sentry/references/semantics/error.md +7 -0
- package/skills/sentry/references/semantics/event.md +8 -0
- package/skills/sentry/references/semantics/exception.md +10 -0
- package/skills/sentry/references/semantics/faas.md +19 -0
- package/skills/sentry/references/semantics/file.md +8 -0
- package/skills/sentry/references/semantics/flag.md +7 -0
- package/skills/sentry/references/semantics/gcp.md +16 -0
- package/skills/sentry/references/semantics/gen_ai.md +53 -0
- package/skills/sentry/references/semantics/general.md +11 -0
- package/skills/sentry/references/semantics/graphql.md +9 -0
- package/skills/sentry/references/semantics/grpc.md +19 -0
- package/skills/sentry/references/semantics/http.md +34 -0
- package/skills/sentry/references/semantics/index.md +63 -0
- package/skills/sentry/references/semantics/jsonrpc.md +8 -0
- package/skills/sentry/references/semantics/jvm.md +12 -0
- package/skills/sentry/references/semantics/koa.md +7 -0
- package/skills/sentry/references/semantics/logger.md +7 -0
- package/skills/sentry/references/semantics/mcp.md +37 -0
- package/skills/sentry/references/semantics/mdc.md +7 -0
- package/skills/sentry/references/semantics/messaging.md +23 -0
- package/skills/sentry/references/semantics/middleware.md +7 -0
- package/skills/sentry/references/semantics/navigation.md +9 -0
- package/skills/sentry/references/semantics/nel.md +11 -0
- package/skills/sentry/references/semantics/network.md +17 -0
- package/skills/sentry/references/semantics/os.md +15 -0
- package/skills/sentry/references/semantics/otel.md +10 -0
- package/skills/sentry/references/semantics/params.md +7 -0
- package/skills/sentry/references/semantics/process.md +14 -0
- package/skills/sentry/references/semantics/react.md +7 -0
- package/skills/sentry/references/semantics/remix.md +7 -0
- package/skills/sentry/references/semantics/resource.md +7 -0
- package/skills/sentry/references/semantics/rpc.md +10 -0
- package/skills/sentry/references/semantics/score.md +10 -0
- package/skills/sentry/references/semantics/sentry.md +69 -0
- package/skills/sentry/references/semantics/server.md +8 -0
- package/skills/sentry/references/semantics/service.md +8 -0
- package/skills/sentry/references/semantics/session.md +7 -0
- package/skills/sentry/references/semantics/state.md +7 -0
- package/skills/sentry/references/semantics/thread.md +8 -0
- package/skills/sentry/references/semantics/timber.md +7 -0
- package/skills/sentry/references/semantics/trpc.md +8 -0
- package/skills/sentry/references/semantics/ui.md +18 -0
- package/skills/sentry/references/semantics/url.md +15 -0
- package/skills/sentry/references/semantics/user.md +17 -0
- package/skills/sentry/references/semantics/user_agent.md +7 -0
- package/skills/sentry/references/semantics/vercel.md +42 -0
- package/skills/sentry/references/setup-verification.md +39 -0
- package/skills/sentry/references/snapshots/github-actions-fanout.md +206 -0
- package/skills/sentry/references/snapshots/github-actions-simple.md +102 -0
- package/skills/sentry/references/snapshots/github-actions-swift-snapshot-testing.md +118 -0
- package/skills/sentry/references/snapshots/index.md +19 -0
- package/skills/sentry/references/snapshots/snapshot-previews.md +100 -0
- package/skills/sentry/references/snapshots/snapshots.md +123 -0
- package/skills/sentry/references/snapshots/wizard-setup.md +134 -0
- package/skills/testing/LICENSE +21 -0
- package/skills/testing/NOTICE +7 -0
- package/skills/testing/SKILL.md +13 -19
- package/skills/testing/agents/openai.yaml +1 -2
- package/skills/testing/references/selection.md +23 -0
- package/skills/testing/references/tdd.md +19 -0
- package/skills/testing/references/test-design.md +17 -0
- package/src/catalog.ts +1 -7
- package/skills/build-effect-apis/SKILL.md +0 -81
- package/skills/build-effect-apis/agents/openai.yaml +0 -4
- package/skills/build-effect-clis/SKILL.md +0 -92
- package/skills/build-effect-clis/agents/openai.yaml +0 -4
- package/skills/effect-architecture-audit/agents/openai.yaml +0 -4
- package/skills/effect-atom-state/SKILL.md +0 -97
- package/skills/effect-atom-state/agents/openai.yaml +0 -4
- package/skills/effect-ts/SKILL.md +0 -35
- package/skills/effect-ts/agents/openai.yaml +0 -4
- /package/skills/{build-effect-apis/references → effect-development/references/api}/cloudflare-workers.md +0 -0
- /package/skills/{build-effect-apis/references → effect-development/references/api}/runtime-assembly.md +0 -0
- /package/skills/{build-effect-apis/references → effect-development/references/api}/server-and-middleware.md +0 -0
- /package/skills/{build-effect-apis/references → effect-development/references/api}/shared-contracts.md +0 -0
- /package/skills/{effect-architecture-audit/references → effect-development/references/architecture}/service-and-boundary-audit.md +0 -0
- /package/skills/{effect-atom-state/references → effect-development/references/atom}/effect-atom-lifecycle.md +0 -0
- /package/skills/{effect-atom-state/references → effect-development/references/atom}/effect-atom-workflows.md +0 -0
- /package/skills/{effect-atom-state/references → effect-development/references/atom}/tanstack-start.md +0 -0
- /package/skills/{build-effect-clis/references → effect-development/references/cli}/command-design.md +0 -0
- /package/skills/{build-effect-clis/references → effect-development/references/cli}/processes-and-platform.md +0 -0
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
# Sentry NestJS SDK
|
|
2
|
+
|
|
3
|
+
Opinionated wizard that scans your NestJS project and guides you through complete Sentry
|
|
4
|
+
setup.
|
|
5
|
+
|
|
6
|
+
> **Note:** SDK versions and APIs below reflect `@sentry/nestjs` 10.x (NestJS 8–11
|
|
7
|
+
> supported). Always verify against
|
|
8
|
+
> [docs.sentry.io/platforms/node/guides/nestjs/](https://docs.sentry.io/platforms/node/guides/nestjs/)
|
|
9
|
+
> before implementing.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Phase 1: Detect
|
|
14
|
+
|
|
15
|
+
Run these commands to understand the project before making recommendations:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Confirm NestJS project
|
|
19
|
+
grep -E '"@nestjs/core"' package.json 2>/dev/null
|
|
20
|
+
|
|
21
|
+
# Check NestJS version
|
|
22
|
+
node -e "console.log(require('./node_modules/@nestjs/core/package.json').version)" 2>/dev/null
|
|
23
|
+
|
|
24
|
+
# Check existing Sentry
|
|
25
|
+
grep -i sentry package.json 2>/dev/null
|
|
26
|
+
ls src/instrument.ts 2>/dev/null
|
|
27
|
+
grep -r "Sentry.init\|@sentry" src/main.ts src/instrument.ts 2>/dev/null
|
|
28
|
+
|
|
29
|
+
# Check for existing Sentry DI wrapper (common in enterprise NestJS)
|
|
30
|
+
grep -rE "SENTRY.*TOKEN|SentryProxy|SentryService" src/ libs/ 2>/dev/null
|
|
31
|
+
|
|
32
|
+
# Check for config-class-based init (vs env-var-based)
|
|
33
|
+
grep -rE "class SentryConfig|SentryConfig" src/ libs/ 2>/dev/null
|
|
34
|
+
|
|
35
|
+
# Check if SentryModule.forRoot() is already registered in a shared module
|
|
36
|
+
grep -rE "SentryModule\.forRoot|SentryProxyModule" src/ libs/ 2>/dev/null
|
|
37
|
+
|
|
38
|
+
# Detect HTTP adapter (default is Express)
|
|
39
|
+
grep -E "FastifyAdapter|@nestjs/platform-fastify" package.json src/main.ts 2>/dev/null
|
|
40
|
+
|
|
41
|
+
# Detect GraphQL
|
|
42
|
+
grep -E '"@nestjs/graphql"|"apollo-server"' package.json 2>/dev/null
|
|
43
|
+
|
|
44
|
+
# Detect microservices
|
|
45
|
+
grep '"@nestjs/microservices"' package.json 2>/dev/null
|
|
46
|
+
|
|
47
|
+
# Detect WebSockets
|
|
48
|
+
grep -E '"@nestjs/websockets"|"socket.io"' package.json 2>/dev/null
|
|
49
|
+
|
|
50
|
+
# Detect task queues / scheduled jobs
|
|
51
|
+
grep -E '"@nestjs/bull"|"@nestjs/bullmq"|"@nestjs/schedule"|"bullmq"|"bull"' package.json 2>/dev/null
|
|
52
|
+
|
|
53
|
+
# Detect databases
|
|
54
|
+
grep -E '"@prisma/client"|"typeorm"|"mongoose"|"pg"|"mysql2"' package.json 2>/dev/null
|
|
55
|
+
|
|
56
|
+
# Detect AI libraries
|
|
57
|
+
grep -E '"openai"|"@anthropic-ai"|"langchain"|"@langchain"|"@google/generative-ai"|"ai"' package.json 2>/dev/null
|
|
58
|
+
|
|
59
|
+
# Check for companion frontend
|
|
60
|
+
ls -d ../frontend ../web ../client ../ui 2>/dev/null
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**What to note:**
|
|
64
|
+
|
|
65
|
+
- Is `@sentry/nestjs` already installed?
|
|
66
|
+
If yes, check if `instrument.ts` exists and `Sentry.init()` is called — may just need
|
|
67
|
+
feature config.
|
|
68
|
+
- **Sentry DI wrapper detected?** → The project wraps Sentry behind a DI token (e.g.
|
|
69
|
+
`SENTRY_PROXY_TOKEN`) for testability.
|
|
70
|
+
Use the injected proxy for all runtime Sentry calls (`startSpan`, `captureException`,
|
|
71
|
+
`withIsolationScope`) instead of importing `@sentry/nestjs` directly in controllers,
|
|
72
|
+
services, and processors.
|
|
73
|
+
Only `instrument.ts` should import `@sentry/nestjs` directly.
|
|
74
|
+
- **Config class detected?** → The project uses a typed config class for `Sentry.init()`
|
|
75
|
+
options (e.g. loaded from YAML or `@nestjs/config`). Any new SDK options must be added
|
|
76
|
+
to the config type — do not hardcode values that should be configurable per
|
|
77
|
+
environment.
|
|
78
|
+
- **`SentryModule.forRoot()` already registered?** → If it’s in a shared module (e.g. a
|
|
79
|
+
Sentry proxy module), do not add it again in `AppModule` — this causes duplicate
|
|
80
|
+
interceptor registration.
|
|
81
|
+
- Express (default) or Fastify adapter?
|
|
82
|
+
Express is fully supported; Fastify works but has known edge cases.
|
|
83
|
+
- GraphQL detected? → `SentryGlobalFilter` handles it natively.
|
|
84
|
+
- Microservices detected?
|
|
85
|
+
→ Recommend RPC exception filter.
|
|
86
|
+
- Task queues / `@nestjs/schedule`? → Recommend crons.
|
|
87
|
+
- AI libraries? → Auto-instrumented, zero config.
|
|
88
|
+
- Prisma? → Requires manual `prismaIntegration()`.
|
|
89
|
+
- Companion frontend? → Triggers Phase 4 cross-link.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Phase 2: Recommend
|
|
94
|
+
|
|
95
|
+
Based on what you found, present a concrete proposal.
|
|
96
|
+
Don’t ask open-ended questions — lead with a recommendation:
|
|
97
|
+
|
|
98
|
+
**Always recommended (core coverage):**
|
|
99
|
+
|
|
100
|
+
- ✅ **Error Monitoring** — captures unhandled exceptions across HTTP, GraphQL, RPC, and
|
|
101
|
+
WebSocket contexts
|
|
102
|
+
- ✅ **Tracing** — auto-instruments middleware, guards, pipes, interceptors, filters, and
|
|
103
|
+
route handlers
|
|
104
|
+
|
|
105
|
+
**Recommend when detected:**
|
|
106
|
+
|
|
107
|
+
- ✅ **Profiling** — production apps where CPU performance matters
|
|
108
|
+
(`@sentry/profiling-node`)
|
|
109
|
+
- ✅ **Logging** — structured Sentry Logs + optional console capture
|
|
110
|
+
- ✅ **Crons** — `@nestjs/schedule`, Bull, or BullMQ detected
|
|
111
|
+
- ✅ **Metrics** — business KPIs or SLO tracking
|
|
112
|
+
- ✅ **AI Monitoring** — OpenAI/Anthropic/LangChain/etc.
|
|
113
|
+
detected (auto-instrumented, zero config)
|
|
114
|
+
|
|
115
|
+
**Recommendation matrix:**
|
|
116
|
+
|
|
117
|
+
| Feature | Recommend when … | Reference |
|
|
118
|
+
| ---------------- | -------------------------------------------------- | ----------------------- |
|
|
119
|
+
| Error Monitoring | **Always** — non-negotiable baseline | `./error-monitoring.md` |
|
|
120
|
+
| Tracing | **Always** — NestJS lifecycle is auto-instrumented | `./tracing.md` |
|
|
121
|
+
| Profiling | Production + CPU-sensitive workloads | `./profiling.md` |
|
|
122
|
+
| Logging | Always; enhanced for structured log aggregation | `./logging.md` |
|
|
123
|
+
| Metrics | Custom business KPIs or SLO tracking | `./metrics.md` |
|
|
124
|
+
| Crons | `@nestjs/schedule`, Bull, or BullMQ detected | `./crons.md` |
|
|
125
|
+
| AI Monitoring | OpenAI/Anthropic/LangChain/etc. detected | `./ai-monitoring.md` |
|
|
126
|
+
|
|
127
|
+
Propose: _“I recommend Error Monitoring + Tracing + Logging.
|
|
128
|
+
Want Profiling, Crons, or AI Monitoring too?”_
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Phase 3: Guide
|
|
133
|
+
|
|
134
|
+
### Install
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Core SDK (always required — includes @sentry/node)
|
|
138
|
+
npm install @sentry/nestjs
|
|
139
|
+
|
|
140
|
+
# With profiling support (optional)
|
|
141
|
+
npm install @sentry/nestjs @sentry/profiling-node
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
> ⚠️ **Do NOT install `@sentry/node` alongside `@sentry/nestjs`** — `@sentry/nestjs`
|
|
145
|
+
> re-exports everything from `@sentry/node`. Installing both causes duplicate
|
|
146
|
+
> registration.
|
|
147
|
+
|
|
148
|
+
### Three-File Setup (Required)
|
|
149
|
+
|
|
150
|
+
NestJS requires a specific three-file initialization pattern because the Sentry SDK must
|
|
151
|
+
patch Node.js modules (via OpenTelemetry) **before** NestJS loads them.
|
|
152
|
+
|
|
153
|
+
> **Before creating new files**, check Phase 1 results:
|
|
154
|
+
>
|
|
155
|
+
> - If `instrument.ts` already exists → modify it, don’t create a new one.
|
|
156
|
+
> - If a config class drives `Sentry.init()` → read options from the config instead of
|
|
157
|
+
> hardcoding env vars.
|
|
158
|
+
> - If a Sentry DI wrapper exists → use it for runtime calls instead of importing
|
|
159
|
+
> `@sentry/nestjs` directly in services/controllers.
|
|
160
|
+
|
|
161
|
+
#### Step 1: Create `src/instrument.ts`
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
import * as Sentry from "@sentry/nestjs";
|
|
165
|
+
// Optional: add profiling
|
|
166
|
+
// import { nodeProfilingIntegration } from "@sentry/profiling-node";
|
|
167
|
+
|
|
168
|
+
Sentry.init({
|
|
169
|
+
dsn: process.env.SENTRY_DSN,
|
|
170
|
+
environment: process.env.SENTRY_ENVIRONMENT ?? "production",
|
|
171
|
+
release: process.env.SENTRY_RELEASE,
|
|
172
|
+
|
|
173
|
+
// Data collection (SDK ≥ 10.57.0 — replaces deprecated sendDefaultPii)
|
|
174
|
+
dataCollection: {
|
|
175
|
+
// To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
|
|
176
|
+
// https://docs.sentry.io/platforms/javascript/guides/nestjs/configuration/options/#dataCollection
|
|
177
|
+
// userInfo: false,
|
|
178
|
+
// httpBodies: [],
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
// Tracing — lower to 0.1–0.2 in high-traffic production
|
|
182
|
+
tracesSampleRate: 1.0,
|
|
183
|
+
|
|
184
|
+
// Profiling (requires @sentry/profiling-node)
|
|
185
|
+
// integrations: [nodeProfilingIntegration()],
|
|
186
|
+
// profileSessionSampleRate: 1.0,
|
|
187
|
+
// profileLifecycle: "trace",
|
|
188
|
+
|
|
189
|
+
// Structured logs (SDK ≥ 9.41.0)
|
|
190
|
+
enableLogs: true,
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Config-driven `Sentry.init()`:** If Phase 1 found a typed config class (e.g.
|
|
195
|
+
`SentryConfig`), read options from it instead of using raw `process.env`. This is common
|
|
196
|
+
in NestJS apps that use `@nestjs/config` or custom config loaders:
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
import * as Sentry from "@sentry/nestjs";
|
|
200
|
+
import { loadConfiguration } from "./config";
|
|
201
|
+
|
|
202
|
+
const config = loadConfiguration();
|
|
203
|
+
|
|
204
|
+
Sentry.init({
|
|
205
|
+
dsn: config.sentry.dsn,
|
|
206
|
+
environment: config.sentry.environment ?? "production",
|
|
207
|
+
release: config.sentry.release,
|
|
208
|
+
dataCollection:
|
|
209
|
+
config.sentry.dataCollection ??
|
|
210
|
+
{
|
|
211
|
+
// To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
|
|
212
|
+
// https://docs.sentry.io/platforms/javascript/guides/nestjs/configuration/options/#dataCollection
|
|
213
|
+
// userInfo: false,
|
|
214
|
+
// httpBodies: [],
|
|
215
|
+
},
|
|
216
|
+
tracesSampleRate: config.sentry.tracesSampleRate ?? 1.0,
|
|
217
|
+
profileSessionSampleRate: config.sentry.profilesSampleRate ?? 1.0,
|
|
218
|
+
profileLifecycle: "trace",
|
|
219
|
+
enableLogs: true,
|
|
220
|
+
});
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
When adding new SDK options (e.g. `dataCollection`, `profileSessionSampleRate`), add
|
|
224
|
+
them to the config type so they can be configured per environment.
|
|
225
|
+
|
|
226
|
+
#### Step 2: Import `instrument.ts` FIRST in `src/main.ts`
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
// instrument.ts MUST be the very first import — before NestJS or any other module
|
|
230
|
+
import "./instrument";
|
|
231
|
+
|
|
232
|
+
import { NestFactory } from "@nestjs/core";
|
|
233
|
+
import { AppModule } from "./app.module";
|
|
234
|
+
|
|
235
|
+
async function bootstrap() {
|
|
236
|
+
const app = await NestFactory.create(AppModule);
|
|
237
|
+
|
|
238
|
+
// Enable graceful shutdown — flushes Sentry events on SIGTERM/SIGINT
|
|
239
|
+
app.enableShutdownHooks();
|
|
240
|
+
|
|
241
|
+
await app.listen(3000);
|
|
242
|
+
}
|
|
243
|
+
bootstrap();
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
> **Why first?** OpenTelemetry must monkey-patch `http`, `express`, database drivers,
|
|
247
|
+
> and other modules before they load.
|
|
248
|
+
> Any module that loads before `instrument.ts` will not be auto-instrumented.
|
|
249
|
+
|
|
250
|
+
#### Step 3: Register `SentryModule` and `SentryGlobalFilter` in `src/app.module.ts`
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
import { Module } from "@nestjs/common";
|
|
254
|
+
import { APP_FILTER } from "@nestjs/core";
|
|
255
|
+
import { SentryModule, SentryGlobalFilter } from "@sentry/nestjs/setup";
|
|
256
|
+
import { AppController } from "./app.controller";
|
|
257
|
+
import { AppService } from "./app.service";
|
|
258
|
+
|
|
259
|
+
@Module({
|
|
260
|
+
imports: [
|
|
261
|
+
SentryModule.forRoot(), // Registers SentryTracingInterceptor globally
|
|
262
|
+
],
|
|
263
|
+
controllers: [AppController],
|
|
264
|
+
providers: [
|
|
265
|
+
AppService,
|
|
266
|
+
{
|
|
267
|
+
provide: APP_FILTER,
|
|
268
|
+
useClass: SentryGlobalFilter, // Captures all unhandled exceptions
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
})
|
|
272
|
+
export class AppModule {}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**What each piece does:**
|
|
276
|
+
|
|
277
|
+
- `SentryModule.forRoot()` — registers `SentryTracingInterceptor` as a global
|
|
278
|
+
`APP_INTERCEPTOR`, enabling HTTP transaction naming
|
|
279
|
+
- `SentryGlobalFilter` — extends `BaseExceptionFilter`; captures exceptions across HTTP,
|
|
280
|
+
GraphQL (rethrows `HttpException` without reporting), and RPC contexts
|
|
281
|
+
|
|
282
|
+
> ⚠️ **Do NOT register `SentryModule.forRoot()` twice.** If Phase 1 found it already
|
|
283
|
+
> imported in a shared library module (e.g. a `SentryProxyModule` or `AnalyticsModule`),
|
|
284
|
+
> do not add it again in `AppModule`. Duplicate registration causes every span to be
|
|
285
|
+
> intercepted twice, bloating trace data.
|
|
286
|
+
|
|
287
|
+
> ⚠️ **Two entrypoints, different imports:**
|
|
288
|
+
>
|
|
289
|
+
> - `@sentry/nestjs` → SDK init, capture APIs, decorators (`SentryTraced`, `SentryCron`,
|
|
290
|
+
> `SentryExceptionCaptured`)
|
|
291
|
+
> - `@sentry/nestjs/setup` → NestJS DI constructs (`SentryModule`, `SentryGlobalFilter`)
|
|
292
|
+
>
|
|
293
|
+
> Never import `SentryModule` from `@sentry/nestjs` (main entrypoint) — it loads
|
|
294
|
+
> `@nestjs/common` before OpenTelemetry patches it, breaking auto-instrumentation.
|
|
295
|
+
|
|
296
|
+
### ESM Setup (Node ≥ 18.19.0)
|
|
297
|
+
|
|
298
|
+
For ESM applications, use `--import` instead of a file import:
|
|
299
|
+
|
|
300
|
+
```javascript
|
|
301
|
+
// instrument.mjs
|
|
302
|
+
import * as Sentry from "@sentry/nestjs";
|
|
303
|
+
|
|
304
|
+
Sentry.init({
|
|
305
|
+
dsn: process.env.SENTRY_DSN,
|
|
306
|
+
tracesSampleRate: 1.0,
|
|
307
|
+
});
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
```json
|
|
311
|
+
// package.json
|
|
312
|
+
{
|
|
313
|
+
"scripts": {
|
|
314
|
+
"start": "node --import ./instrument.mjs -r ts-node/register src/main.ts"
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Or via environment:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
NODE_OPTIONS="--import ./instrument.mjs" npm run start
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Exception Filter Options
|
|
326
|
+
|
|
327
|
+
Choose the approach that fits your existing architecture:
|
|
328
|
+
|
|
329
|
+
#### Option A: No existing global filter — use `SentryGlobalFilter` (recommended)
|
|
330
|
+
|
|
331
|
+
Already covered in Step 3 above.
|
|
332
|
+
This is the simplest option.
|
|
333
|
+
|
|
334
|
+
#### Option B: Existing custom global filter — add `@SentryExceptionCaptured()` decorator
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
import { Catch, ExceptionFilter, ArgumentsHost } from "@nestjs/common";
|
|
338
|
+
import { SentryExceptionCaptured } from "@sentry/nestjs";
|
|
339
|
+
|
|
340
|
+
@Catch()
|
|
341
|
+
export class YourExistingFilter implements ExceptionFilter {
|
|
342
|
+
@SentryExceptionCaptured() // Wraps catch() to auto-report exceptions
|
|
343
|
+
catch(exception: unknown, host: ArgumentsHost): void {
|
|
344
|
+
// Your existing error handling continues unchanged
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
#### Option C: Specific exception type — manual capture
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
import { ArgumentsHost, Catch } from "@nestjs/common";
|
|
353
|
+
import { BaseExceptionFilter } from "@nestjs/core";
|
|
354
|
+
import * as Sentry from "@sentry/nestjs";
|
|
355
|
+
|
|
356
|
+
@Catch(ExampleException)
|
|
357
|
+
export class ExampleExceptionFilter extends BaseExceptionFilter {
|
|
358
|
+
catch(exception: ExampleException, host: ArgumentsHost) {
|
|
359
|
+
Sentry.captureException(exception);
|
|
360
|
+
super.catch(exception, host);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
#### Option D: Microservice RPC exceptions
|
|
366
|
+
|
|
367
|
+
```typescript
|
|
368
|
+
import { Catch, RpcExceptionFilter, ArgumentsHost } from "@nestjs/common";
|
|
369
|
+
import { Observable, throwError } from "rxjs";
|
|
370
|
+
import { RpcException } from "@nestjs/microservices";
|
|
371
|
+
import * as Sentry from "@sentry/nestjs";
|
|
372
|
+
|
|
373
|
+
@Catch(RpcException)
|
|
374
|
+
export class SentryRpcFilter implements RpcExceptionFilter<RpcException> {
|
|
375
|
+
catch(exception: RpcException, host: ArgumentsHost): Observable<any> {
|
|
376
|
+
Sentry.captureException(exception);
|
|
377
|
+
return throwError(() => exception.getError());
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Decorators
|
|
383
|
+
|
|
384
|
+
#### `@SentryTraced(op?)` — Instrument any method
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
import { Injectable } from "@nestjs/common";
|
|
388
|
+
import { SentryTraced } from "@sentry/nestjs";
|
|
389
|
+
|
|
390
|
+
@Injectable()
|
|
391
|
+
export class OrderService {
|
|
392
|
+
@SentryTraced("order.process")
|
|
393
|
+
async processOrder(orderId: string): Promise<void> {
|
|
394
|
+
// Automatically wrapped in a Sentry span
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
@SentryTraced() // Defaults to op: "function"
|
|
398
|
+
async fetchInventory() { ... }
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
#### `@SentryCron(slug, config?)` — Monitor scheduled jobs
|
|
403
|
+
|
|
404
|
+
```typescript
|
|
405
|
+
import { Injectable } from "@nestjs/common";
|
|
406
|
+
import { Cron } from "@nestjs/schedule";
|
|
407
|
+
import { SentryCron } from "@sentry/nestjs";
|
|
408
|
+
|
|
409
|
+
@Injectable()
|
|
410
|
+
export class ReportService {
|
|
411
|
+
@Cron("0 * * * *")
|
|
412
|
+
@SentryCron("hourly-report", {
|
|
413
|
+
// @SentryCron must come AFTER @Cron
|
|
414
|
+
schedule: { type: "crontab", value: "0 * * * *" },
|
|
415
|
+
checkinMargin: 2, // Minutes before marking missed
|
|
416
|
+
maxRuntime: 10, // Max runtime in minutes
|
|
417
|
+
timezone: "UTC",
|
|
418
|
+
})
|
|
419
|
+
async generateReport() {
|
|
420
|
+
// Check-in sent automatically on start/success/failure
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
#### Background Job Scope Isolation
|
|
426
|
+
|
|
427
|
+
Background jobs share the default isolation scope — wrap with
|
|
428
|
+
`Sentry.withIsolationScope()` to prevent cross-contamination:
|
|
429
|
+
|
|
430
|
+
```typescript
|
|
431
|
+
import * as Sentry from "@sentry/nestjs";
|
|
432
|
+
import { Injectable } from "@nestjs/common";
|
|
433
|
+
import { Cron, CronExpression } from "@nestjs/schedule";
|
|
434
|
+
|
|
435
|
+
@Injectable()
|
|
436
|
+
export class JobService {
|
|
437
|
+
@Cron(CronExpression.EVERY_HOUR)
|
|
438
|
+
async handleCron() {
|
|
439
|
+
await Sentry.withIsolationScope(async () => {
|
|
440
|
+
Sentry.setTag("job", "hourly-sync");
|
|
441
|
+
await this.doWork();
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
Apply `withIsolationScope` to: `@Cron()`, `@Interval()`, `@OnEvent()`, `@Processor()`,
|
|
448
|
+
and any code outside the request lifecycle.
|
|
449
|
+
|
|
450
|
+
### Working with Sentry DI Wrappers
|
|
451
|
+
|
|
452
|
+
Some NestJS projects wrap Sentry behind a dependency injection token (e.g.
|
|
453
|
+
`SENTRY_PROXY_TOKEN`) for testability and decoupling.
|
|
454
|
+
If Phase 1 detected this pattern, **use the injected service for all runtime Sentry
|
|
455
|
+
calls** — do not import `@sentry/nestjs` directly in controllers, services, or
|
|
456
|
+
processors.
|
|
457
|
+
|
|
458
|
+
```typescript
|
|
459
|
+
import { Controller, Inject } from "@nestjs/common";
|
|
460
|
+
import { SENTRY_PROXY_TOKEN, type SentryProxyService } from "./sentry-proxy";
|
|
461
|
+
|
|
462
|
+
@Controller("orders")
|
|
463
|
+
export class OrderController {
|
|
464
|
+
constructor(
|
|
465
|
+
@Inject(SENTRY_PROXY_TOKEN) private readonly sentry: SentryProxyService,
|
|
466
|
+
private readonly orderService: OrderService,
|
|
467
|
+
) {}
|
|
468
|
+
|
|
469
|
+
@Post()
|
|
470
|
+
async createOrder(@Body() dto: CreateOrderDto) {
|
|
471
|
+
return this.sentry.startSpan({ name: "createOrder", op: "http" }, async () =>
|
|
472
|
+
this.orderService.create(dto),
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
**Where direct `@sentry/nestjs` import is still correct:**
|
|
479
|
+
|
|
480
|
+
- `instrument.ts` — always uses `import * as Sentry from "@sentry/nestjs"` for
|
|
481
|
+
`Sentry.init()`
|
|
482
|
+
- Standalone scripts and exception filters that run outside the DI container
|
|
483
|
+
|
|
484
|
+
### Verification
|
|
485
|
+
|
|
486
|
+
Add a test endpoint to confirm events reach Sentry:
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
import { Controller, Get } from "@nestjs/common";
|
|
490
|
+
import * as Sentry from "@sentry/nestjs";
|
|
491
|
+
|
|
492
|
+
@Controller()
|
|
493
|
+
export class DebugController {
|
|
494
|
+
@Get("/debug-sentry")
|
|
495
|
+
triggerError() {
|
|
496
|
+
throw new Error("My first Sentry error from NestJS!");
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
@Get("/debug-sentry-span")
|
|
500
|
+
triggerSpan() {
|
|
501
|
+
return Sentry.startSpan({ op: "test", name: "NestJS Test Span" }, () => {
|
|
502
|
+
return { status: "span created" };
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
Hit `GET /debug-sentry` and check the Sentry Issues dashboard within seconds.
|
|
509
|
+
|
|
510
|
+
### For Each Agreed Feature
|
|
511
|
+
|
|
512
|
+
Walk through features one at a time.
|
|
513
|
+
Load the reference, follow its steps, verify before moving on:
|
|
514
|
+
|
|
515
|
+
| Feature | Reference file | Load when … |
|
|
516
|
+
| ---------------- | ----------------------- | -------------------------------------- |
|
|
517
|
+
| Error Monitoring | `./error-monitoring.md` | Always (baseline) |
|
|
518
|
+
| Tracing | `./tracing.md` | Always (NestJS routes are auto-traced) |
|
|
519
|
+
| Profiling | `./profiling.md` | CPU-intensive production apps |
|
|
520
|
+
| Logging | `./logging.md` | Structured log aggregation needed |
|
|
521
|
+
| Metrics | `./metrics.md` | Custom KPIs / SLO tracking |
|
|
522
|
+
| Crons | `./crons.md` | Scheduled jobs or task queues |
|
|
523
|
+
| AI Monitoring | `./ai-monitoring.md` | OpenAI/Anthropic/LangChain detected |
|
|
524
|
+
|
|
525
|
+
For each feature: `Read ./<feature>.md`, follow steps exactly, verify it works.
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
## Configuration Reference
|
|
530
|
+
|
|
531
|
+
### Key `Sentry.init()` Options
|
|
532
|
+
|
|
533
|
+
| Option | Type | Default | Purpose |
|
|
534
|
+
| ---------------------------- | ----------------------- | -------------- | ------------------------------------------------------------------------------------------------ |
|
|
535
|
+
| `dsn` | `string` | — | SDK disabled if empty; env: `SENTRY_DSN` |
|
|
536
|
+
| `environment` | `string` | `"production"` | e.g., `"staging"`; env: `SENTRY_ENVIRONMENT` |
|
|
537
|
+
| `release` | `string` | — | e.g., `"myapp@1.0.0"`; env: `SENTRY_RELEASE` |
|
|
538
|
+
| `dataCollection` | `object` | See below | Controls what data the SDK collects (SDK ≥ 10.57.0) |
|
|
539
|
+
| `dataCollection.userInfo` | `boolean` | `true` | Include IP addresses and user context |
|
|
540
|
+
| `dataCollection.httpHeaders` | `object` | See below | Capture HTTP headers for requests/responses |
|
|
541
|
+
| `dataCollection.cookies` | `boolean\|object` | `true` | Capture cookies; use `{allow: [...]}` or `{deny: [...]}` for filtering |
|
|
542
|
+
| `dataCollection.queryParams` | `boolean\|object` | `true` | Capture URL query parameters; use `{allow: [...]}` or `{deny: [...]}` for filtering |
|
|
543
|
+
| `dataCollection.genAI` | `object` | See below | Control AI input/output recording |
|
|
544
|
+
| `sendDefaultPii` | `boolean` | `false` | **Deprecated** — use `dataCollection.userInfo` instead |
|
|
545
|
+
| `tracesSampleRate` | `number` | — | Transaction sample rate; `undefined` disables tracing |
|
|
546
|
+
| `tracesSampler` | `function` | — | Custom per-transaction sampling (overrides rate) |
|
|
547
|
+
| `tracePropagationTargets` | `Array<string\|RegExp>` | — | URLs to propagate `sentry-trace`/`baggage` headers to |
|
|
548
|
+
| `profileSessionSampleRate` | `number` | — | Continuous profiling session rate (SDK ≥ 10.27.0) |
|
|
549
|
+
| `profileLifecycle` | `"trace"\|"manual"` | `"trace"` | `"trace"` = auto-start profiler with spans; `"manual"` = call `startProfiler()`/`stopProfiler()` |
|
|
550
|
+
| `enableLogs` | `boolean` | `false` | Send structured logs to Sentry (SDK ≥ 9.41.0) |
|
|
551
|
+
| `ignoreErrors` | `Array<string\|RegExp>` | `[]` | Error message patterns to suppress |
|
|
552
|
+
| `ignoreTransactions` | `Array<string\|RegExp>` | `[]` | Transaction name patterns to suppress |
|
|
553
|
+
| `beforeSend` | `function` | — | Hook to mutate or drop error events |
|
|
554
|
+
| `beforeSendTransaction` | `function` | — | Hook to mutate or drop transaction events |
|
|
555
|
+
| `beforeSendLog` | `function` | — | Hook to mutate or drop log events |
|
|
556
|
+
| `debug` | `boolean` | `false` | Verbose SDK debug output |
|
|
557
|
+
| `maxBreadcrumbs` | `number` | `100` | Max breadcrumbs per event |
|
|
558
|
+
|
|
559
|
+
**`dataCollection` defaults:**
|
|
560
|
+
|
|
561
|
+
- `httpHeaders: { request: true, response: true }`
|
|
562
|
+
- `httpBodies: ["incomingRequest", "outgoingRequest", "incomingResponse", "outgoingResponse"]`
|
|
563
|
+
- `userInfo: true`
|
|
564
|
+
- `genAI: { inputs: true, outputs: true }`
|
|
565
|
+
|
|
566
|
+
### Environment Variables
|
|
567
|
+
|
|
568
|
+
| Variable | Maps to | Notes |
|
|
569
|
+
| -------------------- | --------------- | ------------------------------------------------- |
|
|
570
|
+
| `SENTRY_DSN` | `dsn` | Used if `dsn` not passed to `init()` |
|
|
571
|
+
| `SENTRY_RELEASE` | `release` | Also auto-detected from git SHA, Heroku, CircleCI |
|
|
572
|
+
| `SENTRY_ENVIRONMENT` | `environment` | Falls back to `"production"` |
|
|
573
|
+
| `SENTRY_AUTH_TOKEN` | CLI/source maps | For `npx @sentry/wizard@latest -i sourcemaps` |
|
|
574
|
+
| `SENTRY_ORG` | CLI/source maps | Organization slug |
|
|
575
|
+
| `SENTRY_PROJECT` | CLI/source maps | Project slug |
|
|
576
|
+
|
|
577
|
+
### Auto-Enabled Integrations
|
|
578
|
+
|
|
579
|
+
These integrations activate automatically when their packages are detected — no
|
|
580
|
+
`integrations: [...]` needed:
|
|
581
|
+
|
|
582
|
+
| Auto-enabled | Notes |
|
|
583
|
+
| --------------------------------- | -------------------------------------------------------------------- |
|
|
584
|
+
| `httpIntegration` | Outgoing HTTP calls via `http`/`https`/`fetch` |
|
|
585
|
+
| `expressIntegration` | Express adapter (default NestJS) |
|
|
586
|
+
| `nestIntegration` | NestJS lifecycle (middleware, guards, pipes, interceptors, handlers) |
|
|
587
|
+
| `onUncaughtExceptionIntegration` | Uncaught exceptions |
|
|
588
|
+
| `onUnhandledRejectionIntegration` | Unhandled promise rejections |
|
|
589
|
+
| `openAIIntegration` | OpenAI SDK (when installed) |
|
|
590
|
+
| `anthropicAIIntegration` | Anthropic SDK (when installed) |
|
|
591
|
+
| `langchainIntegration` | LangChain (when installed) |
|
|
592
|
+
| `graphqlIntegration` | GraphQL (when `graphql` package present) |
|
|
593
|
+
| `postgresIntegration` | `pg` driver |
|
|
594
|
+
| `mysqlIntegration` | `mysql` / `mysql2` |
|
|
595
|
+
| `mongoIntegration` | MongoDB / Mongoose |
|
|
596
|
+
| `redisIntegration` | `ioredis` / `redis` |
|
|
597
|
+
|
|
598
|
+
### Integrations Requiring Manual Setup
|
|
599
|
+
|
|
600
|
+
| Integration | When to add | Code |
|
|
601
|
+
| --------------------------- | ---------------------------------- | ------------------------------------------------------------------- |
|
|
602
|
+
| `nodeProfilingIntegration` | Profiling desired | `import { nodeProfilingIntegration } from "@sentry/profiling-node"` |
|
|
603
|
+
| `prismaIntegration` | Prisma ORM used | `integrations: [Sentry.prismaIntegration()]` |
|
|
604
|
+
| `consoleLoggingIntegration` | Capture console output | `integrations: [Sentry.consoleLoggingIntegration()]` |
|
|
605
|
+
| `localVariablesIntegration` | Capture local var values in errors | `integrations: [Sentry.localVariablesIntegration()]` |
|
|
606
|
+
|
|
607
|
+
---
|
|
608
|
+
|
|
609
|
+
## Verification
|
|
610
|
+
|
|
611
|
+
Test that Sentry is receiving events:
|
|
612
|
+
|
|
613
|
+
```typescript
|
|
614
|
+
// Add a test endpoint (remove before production)
|
|
615
|
+
@Get("/debug-sentry")
|
|
616
|
+
getError() {
|
|
617
|
+
throw new Error("My first Sentry error!");
|
|
618
|
+
}
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
Or send a test message without crashing:
|
|
622
|
+
|
|
623
|
+
```typescript
|
|
624
|
+
import * as Sentry from "@sentry/nestjs";
|
|
625
|
+
Sentry.captureMessage("NestJS Sentry SDK test");
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
If nothing appears:
|
|
629
|
+
|
|
630
|
+
1. Set `debug: true` in `Sentry.init()` — prints SDK internals to stdout
|
|
631
|
+
2. Verify `SENTRY_DSN` env var is set in the running process
|
|
632
|
+
3. Check that `import "./instrument"` is the **first line** in `main.ts`
|
|
633
|
+
4. Confirm `SentryModule.forRoot()` is imported in `AppModule`
|
|
634
|
+
5. Check DSN format: `https://<key>@o<org>.ingest.sentry.io/<project>`
|
|
635
|
+
|
|
636
|
+
---
|
|
637
|
+
|
|
638
|
+
## Phase 4: Cross-Link
|
|
639
|
+
|
|
640
|
+
After completing NestJS setup, check for a companion frontend missing Sentry:
|
|
641
|
+
|
|
642
|
+
```bash
|
|
643
|
+
ls -d ../frontend ../web ../client ../ui 2>/dev/null
|
|
644
|
+
cat ../frontend/package.json ../web/package.json 2>/dev/null \
|
|
645
|
+
| grep -E '"react"|"svelte"|"vue"|"next"|"nuxt"'
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
If a frontend exists without Sentry, suggest the matching skill:
|
|
649
|
+
|
|
650
|
+
| Frontend detected | Suggest skill |
|
|
651
|
+
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
652
|
+
| Next.js | [`nextjs`](../nextjs/index.md) |
|
|
653
|
+
| React | [`react`](../react/index.md) |
|
|
654
|
+
| Svelte / SvelteKit | [`svelte`](../svelte/index.md) |
|
|
655
|
+
| Vue / Nuxt | Use `@sentry/vue` — see [docs.sentry.io/platforms/javascript/guides/vue/](https://docs.sentry.io/platforms/javascript/guides/vue/) |
|
|
656
|
+
| React Native / Expo | [`react-native`](../react-native/index.md) |
|
|
657
|
+
|
|
658
|
+
---
|
|
659
|
+
|
|
660
|
+
## Troubleshooting
|
|
661
|
+
|
|
662
|
+
| Issue | Solution |
|
|
663
|
+
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
664
|
+
| Events not appearing | Set `debug: true`, verify `SENTRY_DSN`, check `instrument.ts` is imported first |
|
|
665
|
+
| Malformed DSN error | Format: `https://<key>@o<org>.ingest.sentry.io/<project>` |
|
|
666
|
+
| Exceptions not captured | Ensure `SentryGlobalFilter` is registered via `APP_FILTER` in `AppModule` |
|
|
667
|
+
| Auto-instrumentation not working | `instrument.ts` must be the **first import** in `main.ts` — before all NestJS imports |
|
|
668
|
+
| Profiling not starting | Requires `tracesSampleRate > 0` + `profileSessionSampleRate > 0` + `@sentry/profiling-node` installed |
|
|
669
|
+
| `enableLogs` not working | Requires SDK ≥ 9.41.0 |
|
|
670
|
+
| No traces appearing | Verify `tracesSampleRate` is set (not `undefined`) |
|
|
671
|
+
| Too many transactions | Lower `tracesSampleRate` or use `tracesSampler` to drop health checks |
|
|
672
|
+
| Fastify + GraphQL issues | Known edge cases — see [GitHub #13388](https://github.com/getsentry/sentry-javascript/issues/13388); prefer Express for GraphQL |
|
|
673
|
+
| Background job events mixed | Wrap job body in `Sentry.withIsolationScope(() => { ... })` |
|
|
674
|
+
| Prisma spans missing | Add `integrations: [Sentry.prismaIntegration()]` to `Sentry.init()` |
|
|
675
|
+
| ESM syntax errors | Set `registerEsmLoaderHooks: false` (disables ESM hooks; also disables auto-instrumentation for ESM modules) |
|
|
676
|
+
| `SentryModule` breaks instrumentation | Must import from `@sentry/nestjs/setup`, never from `@sentry/nestjs` |
|
|
677
|
+
| RPC exceptions not captured | Add dedicated `SentryRpcExceptionFilter` (see Option D in exception filter section) |
|
|
678
|
+
| WebSocket exceptions not captured | Use `@SentryExceptionCaptured()` on gateway `handleConnection`/`handleDisconnect` |
|
|
679
|
+
| `@SentryCron` not triggering | Decorator order matters — `@SentryCron` MUST come after `@Cron` |
|
|
680
|
+
| TypeScript path alias issues | Ensure `tsconfig.json` `paths` are configured so `instrument` resolves from `main.ts` location |
|
|
681
|
+
| `import * as Sentry` ESLint error | Many projects ban namespace imports. Use named imports (`import { startSpan, captureException } from "@sentry/nestjs"`) or use the project’s DI proxy instead |
|
|
682
|
+
| `profilesSampleRate` vs `profileSessionSampleRate` | `profilesSampleRate` is deprecated in SDK 10.x. Use `profileSessionSampleRate` + `profileLifecycle: "trace"` instead |
|
|
683
|
+
| Duplicate spans on every request | `SentryModule.forRoot()` registered in multiple modules. Ensure it’s only called once — check shared/library modules |
|
|
684
|
+
| Config property not recognized in `instrument.ts` | When using a typed config class, new SDK options must be added to the config type definition and the project rebuilt before TypeScript recognizes them |
|
|
685
|
+
|
|
686
|
+
### Version Requirements
|
|
687
|
+
|
|
688
|
+
| Feature | Minimum SDK Version |
|
|
689
|
+
| ---------------------------------- | ------------------- |
|
|
690
|
+
| `@sentry/nestjs` package | 8.0.0 |
|
|
691
|
+
| `@SentryTraced` decorator | 8.15.0 |
|
|
692
|
+
| `@SentryCron` decorator | 8.16.0 |
|
|
693
|
+
| Event Emitter auto-instrumentation | 8.39.0 |
|
|
694
|
+
| `SentryGlobalFilter` (unified) | 8.40.0 |
|
|
695
|
+
| `Sentry.logger` API (`enableLogs`) | 9.41.0 |
|
|
696
|
+
| `profileSessionSampleRate` | 10.27.0 |
|
|
697
|
+
| Node.js requirement | ≥ 18 |
|
|
698
|
+
| Node.js for ESM `--import` | ≥ 18.19.0 |
|
|
699
|
+
| NestJS compatibility | 8.x – 11.x |
|