Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Sentry Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-sentry-knowledge-patch)
---
name: sentry-knowledge-patch
description: Sentry JavaScript SDK
version: "10.68.0"
license: MIT
metadata:
author: Nevaberry
---
# Sentry JavaScript SDK Knowledge Patch
Use this skill when migrating SDK APIs, configuring framework instrumentation,
changing telemetry collection, or troubleshooting tracing and build integration.
Load the topic reference for the relevant runtime, framework, or telemetry type.
Reference entries retain the version and product scope of the guidance.
## Reference index
| Reference | Topics |
| --- | --- |
| [Migrations and runtime](references/migrations-and-runtime.md) | Runtime floors, package changes, client lifecycle, public APIs, scopes, OpenTelemetry dependencies and loading |
| [Build and serverless](references/build-and-serverless.md) | Source maps, bundler plugins, release injection, Cloudflare Vite, managed tunnels, Lambda and serverless flushing |
| [Framework integrations](references/framework-integrations.md) | Elysia, Hono, Nitro, TanStack Start, Next.js, Nuxt, Vue, SvelteKit, Solid, React Router, Remix, Astro, Gatsby, NestJS, Fastify, Effect, Cloudflare |
| [Telemetry data](references/telemetry-data.md) | Request data, privacy, error processing, sessions, feedback, Replay, structured logs, shared attributes, metrics, cron monitors |
| [Tracing and performance](references/tracing-and-performance.md) | Sampling, propagation, span streaming, origin migrations, browser performance, HTTP spans, database and queue spans, AI and MCP instrumentation |
## Breaking changes and deprecations
### Core imports and context shapes
- Use `Client` for client types and migrate `BaseClient` imports and subclasses.
- Move retained `@sentry/utils` and `@sentry/types` imports to `@sentry/core`.
- Replace `hasTracingEnabled()` with `hasSpansEnabled()`, the core `logger`
export with `debug`, and the `Logger` type with `SentryDebugLogger`.
- Pass only the reason and data category to `recordDroppedEvent`, for example
`client.recordDroppedEvent('before_send', 'error')`.
- In `tracesSampler`, read `normalizedRequest`, `parentSampleRate`, `name`, and
`attributes`; `transactionContext` was removed.
- In `profilesSampler`, replace `request` with `normalizedRequest` and use
top-level fields such as `name` instead of `transactionContext.name`.
- Propagation contexts no longer carry `spanId`. Read an active span ID with
`Sentry.getActiveSpan()?.spanContext().spanId`.
- Include `sampleRand` in `scope.setPropagationContext(...)`; use the optional
`propagationSpanId` to associate the execution with a specific span ID.
- APIs typed with `Scope` require a `Scope` instance. `startSpan` clones a
supplied scope; set persistent tags directly on the supplied scope.
### OpenTelemetry and runtime compatibility
If an application cannot move to OpenTelemetry v2, stay on SDK v9 or use
`@sentry/node-core`, whose OpenTelemetry peer dependency ranges are wider.
From 10.77.1, use OpenTelemetry SDK v2 and `@opentelemetry/api` below 1.10.0
with SDK v10; upgrade to SDK v11 for OpenTelemetry SDK v3 and API 1.10.0.
Pass instrumentation instances in `openTelemetryInstrumentations` instead of
calling `addOpenTelemetryInstrumentation`. Only root spans pass through the
OpenTelemetry sampling pipeline. With a custom OpenTelemetry setup, the Node
SDK's HTTP instrumentation skips span creation by default.
### Error handling and session migration
`requestDataIntegration` no longer populates the event user. Set the user
explicitly when events need request identity. Replace request-data helpers
with `httpRequestToRequestData` and assign its result to `event.request`.
`captureConsoleIntegration` marks exceptions `handled: true` by default.
With `attachStackTrace: true`, configure
`Sentry.captureConsoleIntegration({ handled: false })` to report captured
console messages as unhandled.
Replace `autoSessionTracking` with integration settings. Remove
`browserSessionIntegration()` from browser defaults to disable session tracking;
in Node.js, use `httpIntegration({ trackIncomingRequestsAsSessions: false })`.
Session tracking reads the isolation scope and ignores local-only sessions.
### Span processing and performance migrations
`beforeSendSpan` receives root and child spans and must return a span.
For streamed spans, wrap it in `Sentry.withStreamedSpan()`; an unwrapped hook
forces transaction mode. `StreamedSpanJSON` uses `name`, raw `attributes`,
`end_timestamp`, and `attributes["sentry.op"]` instead of `description`,
processed `data`, `timestamp`, and `op`. Its `status` is `"ok"` or `"error"`.
Move `beforeSendTransaction` drop rules to `ignoreSpans` for stream mode.
Rules match initial names and attributes. A service-span match drops its
descendants; a child-span match reparents its children to the nearest retained
ancestor. Use `debug: true` during development to find initial span names.
The browser SDK stopped collecting FID. Move FID-dependent `beforeSend` logic,
alerts, and dashboards to INP; missing FID values can trigger alerts after an
upgrade. Update origin-based filters using the tracing reference's exact
origin mappings, including the HTTP, database, queue, AI, and web-vital changes.
### Logging, Replay, and framework API removals
Move `enableLogs` and `beforeSendLog` out of `_experiments` into top-level
initialization options. Feedback submission flushes Replay by default;
remove `_experiments.autoFlushOnFeedback`, including explicit `false` settings.
Import `nestIntegration` from `@sentry/nestjs`; remove the retired NestJS
handlers, decorators, services, interceptors, and filters listed in the
framework reference. Remove Remix's `autoInstrumentRemix` option and Vue's
`logErrors` option. Vue forwards errors to a configured error handler and
otherwise rethrows them.
From 11.18.0, replace Effect's `effectLayer` with `layer`,
`SentryEffectTracer` with `layerTracer`, `SentryEffectLogger` with `layerLogger`,
`SentryEffectMetricsLayer` with `layerMetrics`, and
`SentryEffectExternalSpanLayer` with `layerExternalSpan`. Provide tracing and
logging layers directly in Effect v3 or v4; the logging layer preserves
existing loggers, including console output.
### Build integration changes
From 11.8.0, standalone bundler plugins follow the SDK version and require
Node.js 20.19.0 or later. The webpack plugin requires webpack 5.1 or later;
the plugins support self-hosted server versions 26.4.2 or later.
Next.js no longer derives release names from the build ID. Set the release
explicitly if that ID is your release identifier. Remove `hideSourceMaps`;
use `sourcemaps.deleteSourcemapsAfterUpload: false` to keep client maps enabled
by the SDK. Top-level `bundleSizeOptimizations` takes precedence over the
deprecated `webpack.treeshake` setting.
## Common configuration and troubleshooting
### Stream spans and shared attributes
With tracing configured, server and serverless SDKs support
`traceLifecycle: "stream"`; browsers use `Sentry.spanStreamingIntegration()`.
Stream mode is available in SDK 10.x from 10.66.0 and is the default from
11.0.0. Cordova and Electron are excluded.
Finished spans are batched, supporting traces with more than 1,000 spans.
Automatic flushes run every five seconds by default, at 1,000 buffered spans
in a trace, or at the batch size limit. `Sentry.flush()` and `Sentry.close()`
flush buffered spans explicitly. Browser span envelopes have content type
`application/vnd.sentry.items.span.v2+json`.
Use `Sentry.setAttribute()` or `Sentry.setAttributes()` for shared metadata on
streamed spans, logs, and metrics. Keep tags for error events. Use the same
methods on `getGlobalScope()` for app-wide values or on the current scope for
operation-local values. Log and metric attributes accept strings, numbers,
booleans, or arrays of these values.
### Control collected data
Browser defaults collect user identity, HTTP bodies, and URL query parameters,
replacing built-in denylisted values such as `auth` and `password` with
`[Filtered]`. Set `dataCollection.userInfo: false` to disable identity collection.
Set `dataCollection: { httpBodies: [] }` to disable body collection; configure
both client and server initializers in TanStack Start.
`dataCollection.urlQueryParams` controls query parameters in collected URLs
and separate query strings. From 11.17.0, it also filters `key=value` pairs in
URL fragments; `false` drops parameter-bearing fragments while preserving
plain anchors such as `#details` and hash routes such as `#/settings`.
### Structured logs
```js
Sentry.logger.info(Sentry.logger.fmt`Order ${orderId} created`);
```
The tagged template makes interpolated values searchable as attributes.
Configure `consoleLoggingIntegration` with the console methods in `levels`;
additional arguments become attributes such as `message.parameter.0`.
`Sentry.createConsolaReporter()` supports Consola. Logs during an active span
include `sentry.trace.parent_span_id`; on platforms with Session Replay, logs
during an active replay include `sentry.replay_id`.
### Initialize and reuse clients
From 11.5.0, `Sentry.init()` warns if a client is already active and replaces it
without closing it. Call `await Sentry.close()` before reinitializing to unbind
the old client. Then `getClient()` returns `undefined` and `isInitialized()`
returns `false`. Next.js and Remix repeated server initialization returns the
existing client; Cloudflare reuses its cached client only while active. Hono on
Bun and Deno returns the existing client from repeated initialization as of 11.3.0.
### Route managed tunnels
```ts
// Browser SDK
Sentry.init({ dsn, tunnel: true });
// Server SDK
Sentry.init({ dsn, integrations: [Sentry.serveTunnelIntegration()] });
```
`tunnel: true` derives the path from the browser DSN. Pass
`{ allowedDsns: [browserDsn] }` to the integration for a different browser DSN.
From 11.12.0, runtime interception answers tunnel requests before app routing
on Node.js, Bun, Deno, Cloudflare Workers, and AWS Lambda. For manual routing,
set `intercept: false` and call `handleTunnelRequestIfMatched`.
The build reference covers framework support and Next.js tunnel handlers.
### Configure framework entry points
Initialize the alpha Elysia SDK before app creation and wrap the app before routes.
Register Hono middleware before routes; on Node.js, preload its initializer.
The beta Nitro SDK uses a root `instrument.mjs` and `withSentryConfig()` for its build module.
For the documented TanStack Start setup, initialize the client, put the Vite
plugin last, initialize and wrap the server, and place global error middleware
first. Report SSR rendering exceptions separately with `captureException()`.
Use the framework reference for exact imports, runtime requirements, alpha or
beta status, deployment limitations, and error filters.
### Source maps and release injection
The separate options `sourcemaps.upload`, `sourcemaps.injectDebugIds`, and
`sourcemaps.delete` control upload, debug IDs, and deletion. Consult the build
reference for their framework-specific availability and cleanup conditions.
Explicit `filesToDeleteAfterUpload` replaces the default deletion list in
Remix and TanStack Start. Vite and webpack can use `release: { inject: 'html' }`
to put the release in the page and keep it out of chunk hashes.
### AI, MCP, and cron instrumentation
Use `gen_ai.response.object` instead of `ai.response.object` in OpenAI queries.
Decision calls migrate from `gen_ai.evaluate` to `gen_ai.decide` for the
integrations and versions detailed in the tracing reference. Per-call content
recording and span hooks also have integration-specific availability there.
MCP server instrumentation supports metadata trace continuation. With Streamable
HTTP, missing, invalid, or cross-org metadata keeps the MCP span in the transport trace.
Cron integrations cover named Node.js jobs, NestJS `@Cron()` methods, and
Cloudflare Cron Triggers. Each monitored NestJS job creates a billed monitor.
The telemetry and framework references retain opt-ins, exclusions, monitor
slug behavior, schedule conversion, and decorator interaction.