Sentry JavaScript SDK Browser Utilities
Links
General
Common utilities used by the Sentry JavaScript SDKs.
Note: This package is only meant to be used internally, and as such is not part of our public API contract and does not follow semver.
Browser Utilities for all Sentry JavaScript SDKs
Common utilities used by the Sentry JavaScript SDKs.
Note: This package is only meant to be used internally, and as such is not part of our public API contract and does not follow semver.
feat(sveltekit): Add Compatibility for builtin SvelteKit Tracing (#17423)
This release makes the @sentry/sveltekit
SDK compatible with SvelteKit's native observability support introduced in SvelteKit version 2.31.0
.
If you enable both, instrumentation and tracing, the SDK will now initialize early enough to set up additional instrumentation like database queries and it will pick up spans emitted from SvelteKit.
We will follow up with docs how to set up the SDK soon.
For now, If you're on SvelteKit version 2.31.0
or newer, you can easily opt into the new feature:
svelte.config.js
:Move your Sentry.init()
call from src/hooks.server.(js|ts)
to the new instrumentation.server.(js|ts)
file:
// instrumentation.server.ts
import * as Sentry from '@sentry/sveltekit';
Sentry.init({
dsn: '...',
// rest of your config
});
The rest of your Sentry config in hooks.server.ts
(sentryHandle
and handleErrorWithSentry
) should stay the same.
If you prefer to stay on the hooks-file based config for now, the SDK will continue to work as previously.
Thanks to the Svelte team and @elliott-with-the-longest-name-on-github for implementing observability support and for reviewing our PR!
instrumentPrototypeMethods
option to instrument RPC methods for DurableObjects (#17424)By default, Sentry.instrumentDurableObjectWithSentry
will not wrap any RPC methods on the prototype. To enable wrapping for RPC methods, set instrumentPrototypeMethods
to true
or, if performance is a concern, a list of only the methods you want to instrument:
class MyDurableObjectBase extends DurableObject<Env> {
method1() {
// ...
}
method2() {
// ...
}
method3() {
// ...
}
}
// Export your named class as defined in your wrangler config
export const MyDurableObject = Sentry.instrumentDurableObjectWithSentry(
(env: Env) => ({
dsn: "https://ac49b7af3017c458bd12dab9b3328bfc@o4508482761982032.ingest.de.sentry.io/4508482780987481",
tracesSampleRate: 1.0,
instrumentPrototypeMethods: ['method1', 'method3'],
}),
MyDurableObjectBase,
);
requestAnimationFrame
for canvas snapshots (#17380)This release adds support for automatically tracing Anthropic AI SDK requests, providing better observability for AI-powered applications.
ai
v5 (#17395)This release makes the Sentry vercelAiIntegration
compatible with version 5 of Vercel ai
.
The Sentry Nuxt SDK is now considered stable and no longer in beta!
DedicatedWorkerGlobalScope
global object type in registerWebWorker
(#17447)isSentryRequestUrl
(#17393)SystemError
context and remove paths from message (#17331)Work in this release was contributed by @ha1fstack. Thank you for your contribution!
sendDefaultPii
is true
This release includes a fix for a behaviour change
that was originally introduced with v9 of the SDK: User IP Addresses should only be added to Sentry events automatically,
if sendDefaultPii
was set to true
.
However, the change in v9 required further internal adjustment, which should have been included in v10 of the SDK.
Unfortunately, the change did not make it into the initial v10 version but is now applied with 10.4.0
.
There is no API breakage involved and hence it is safe to update.
However, after updating the SDK, events (errors, traces, replays, etc.) sent from the browser, will only include
user IP addresses, if you set sendDefaultPii: true
in your Sentry.init
options.
We apologize for any inconvenience caused!
ignoreStaticAssets
(#17370)This release adds a new option to httpIntegration
to ignore requests for static assets (e.g. favicon.xml
or robots.txt
). The option defaults to true
, meaning that going forward, such requests will not be traced by default. You can still enable tracing for these requests by setting the option to false
:
Sentry.init({
integrations: [
Sentry.httpIntegration({
// defaults to true, set to false to enable traces for static assets
ignoreStaticAssets: false,
}),
],
});
skipOpenTelemetrySetup
option (#17349)globalHandlersIntegration
(#17216)handle
(#17277)ignoreSpans
option (#17078)This release adds a new top-level Sentry.init
option, ignoreSpans
, that can be used as follows:
Sentry.init({
ignoreSpans: [
'partial match', // string matching on the span name
/regex/, // regex matching on the span name
{
name: 'span name',
op: /http.client/,
},
],
});
Spans matching the filter criteria will not be recorded. Potential child spans of filtered spans will be re-parented, if possible.
Adds support for OpenAI manual instrumentation in @sentry/cloudflare
and @sentry/vercel-edge
.
To instrument the OpenAI client, wrap it with Sentry.instrumentOpenAiClient
and set recording settings.
import * as Sentry from '@sentry/cloudflare';
import OpenAI from 'openai';
const openai = new OpenAI();
const client = Sentry.instrumentOpenAiClient(openai, { recordInputs: true, recordOutputs: true });
// use the wrapped client
The startTrace
option is deprecated and will be removed in a future major version. If you want to disable tracing, set SENTRY_TRACES_SAMPLE_RATE
to 0.0
. instead. As of today, the flag does not affect traces anymore.
gen_ai.invoke_agent
spans from child LLM calls (#17281)sentry.origin
span attribute to SentryTraced
decorator (#17318)openai
to the instrumented fn (#17320)sendBufferedReplayOrFlush
when opening/sending feedback (#17236)diagnoseSdkConnectivity
doesn't create span (#17280)Version 10.0.0
marks a release of the Sentry JavaScript SDKs that contains breaking changes. The goal of this release is to primarily upgrade the underlying OpenTelemetry dependencies to v2 with minimal breaking changes.
Please carefully read through the migration guide in the Sentry docs on how to upgrade from version 9 to version 10. Make sure to select your specific platform/framework in the top left corner: https://docs.sentry.io/platforms/javascript/migration/v9-to-v10/
A comprehensive migration guide outlining all changes can be found within the Sentry JavaScript SDK Repository: https://github.com/getsentry/sentry-javascript/blob/develop/MIGRATION.md
BaseClient
(#17071)enableLogs
and beforeSendLog
experimental options (#17063)hasTracingEnabled
(#17072)_experiments.autoFlushOnFeedback
option as default (#17220)SentryNodeServerlessSDKv10
v10 AWS Lambda Layer (#17069)flushIfServerless
function (#17177)strictTraceContinuation
(#16313)@sentry-internal/node-native-stacktrace
to 0.2.2
(#17207)shouldHandleError
option to fastifyIntegration
(#16845)createSentryHandleError
(#17235)fastifyIntegration
error handler (#17208)vercelAiIntegration
have correct trace connected (#17132)handleErrorWithSentry
(#17157)Work in this release was contributed by @richardjelinek-fastest. Thank you for your contribution!
This release is publishing the AWS Lambda Layer under SentryNodeServerlessSDKv9
. The previous release 9.44.1
accidentally published the layer under SentryNodeServerlessSDKv10
.
_experiments.autoFlushOnFeedback
(#17219)flushIfServerless
function (#17239)@sentry-internal/node-native-stacktrace
to 0.2.2
(#17256)createSentryHandleError
(#17244)fastifyIntegration
error handler (#17211)globalThis
(#17185)handleErrorWithSentry
(#17174)enableLogs
and beforeSendLog
option (#17092)Sentry now has support for structured logging. Previously to enable structured logging, you had to use the _experiments.enableLogs
and _experiments.beforeSendLog
options. These options have been deprecated in favor of the top-level enableLogs
and beforeSendLog
options.
// before
Sentry.init({
_experiments: {
enableLogs: true,
beforeSendLog: log => {
return log;
},
},
});
// after
Sentry.init({
enableLogs: true,
beforeSendLog: log => {
return log;
},
});
Server-side and client-side parameterized routes are now supported in the Astro SDK. No configuration changes are required.
vercelAiIntegration
have correct trace (#17142)Work in this release was contributed by @richardjelinek-fastest. Thank you for your contribution!
This release adds two Browser SDK APIs to let the main thread know about debugIds of worker files:
webWorkerIntegration({worker})
to be used in the main threadregisterWebWorker({self})
to be used in the web worker// main.js
Sentry.init({...})
const worker = new MyWorker(...);
Sentry.addIntegration(Sentry.webWorkerIntegration({ worker }));
worker.addEventListener('message', e => {...});
// worker.js
Sentry.registerWebWorker({ self });
self.postMessage(...);
The internal SDK logger
export from @sentry/core
has been deprecated in favor of the debug
export. debug
only exposes log
, warn
, and error
methods but is otherwise identical to logger
. Note that this deprecation does not affect the logger
export from other packages (like @sentry/browser
or @sentry/node
) which is used for Sentry Logging.
import { logger, debug } from '@sentry/core';
// before
logger.info('This is an info message');
// after
debug.log('This is an info message');
This release adds official support for instrumenting OpenAI SDK calls in with Sentry tracing, following OpenTelemetry semantic conventions for Generative AI. It instruments:
client.chat.completions.create()
- For chat-based completionsclient.responses.create()
- For the responses API// The integration respects your `sendDefaultPii` option, but you can override the behavior in the integration options
Sentry.init({
dsn: '__DSN__',
integrations: [
Sentry.openAIIntegration({
recordInputs: true, // Force recording prompts
recordOutputs: true, // Force recording responses
}),
],
});
@opentelemetry/instrumentation
range to cover 0.203.0
(#17043)Work in this release was contributed by @0xbad0c0d3 and @tommy-gilligan. Thank you for your contributions!
afterStartPageloadSpan
hook to improve spanId assignment on web vital spans (#16893)This PR adds a new afterStartPageloadSpan lifecycle hook to more robustly assign the correct pageload span ID to web vital spans, replacing the previous unreliable "wait for a tick" approach with a direct callback that fires when the pageload span becomes available.
This PR implements client-side parameterized routes for Next.js by leveraging an injected manifest within the existing app-router instrumentation to automatically parameterize all client-side transactions (e.g. users/123
and users/456
now become become users/:id
).
This PR changes the default behavior in the Node SDK to drop HTTP spans with 401-404 and 3xx status codes by default to reduce noise in tracing data.
vercel.ai.X
(#16908)disableSentryWebpackConfig
flag (#17013)tracing/errors.ts
(#16888)beforeSendLog
in consoleSandbox
(#16968)source=route
(#16984)Work in this release was contributed by @janpapenbrock. Thank you for your contribution!
This release publishes the @sentry/node-native
SDK.
debug
to replace logger
(#16906)nextHopProtocol
when adding resource spans (#16900)feat(nuxt): Parametrize SSR routes (#16843)
When requesting dynamic or catch-all routes in Nuxt, those will now be shown as parameterized routes in Sentry.
For example, /users/123
will be shown as /users/:userId()
in Sentry. This will make it easier to identify patterns and make grouping easier.
beforeStartNavigationSpan
lifecycle hook (#16863)wrapRequestHandler
(#16852)instrumentation-client.ts|js
(#16855)redirect()
calls as errors in Cloudflare (#16853)deleteSourcemapsAfterUpload
jsdoc default value (#16867)Work in this release was contributed by @zachkirsch. Thank you for your contribution!
This release adds a new SDK @sentry/node-core
which ships without any OpenTelemetry instrumententation out of the box. All OpenTelemetry dependencies are peer dependencies and OpenTelemetry has to be set up manually.
Use @sentry/node-core
when:
Use @sentry/node
when:
You prefer convenience over control
feat(node): Deprecate ANR integration (#16832)
The ANR integration has been deprecated and will be removed in future versions. Use eventLoopBlockIntegration
from @sentry/node-native
instead.
_experiments.ignoreMutations
option (#16816)This replay option allows to configure a selector list of elements to not capture mutations for.
Sentry.replayIntegration({
_experiments: {
ignoreMutations: ['.dragging'],
},
});
@sentry/replay-internal
(#16794)diagnoseSdkConnectivity
request (#16840)Work in this release was contributed by @Spice-King and @stayallive. Thank you for your contributions!
Context
and Contexts
types (#16763)eventLoopBlockIntegration
(#16709)parentSpan
is considered (#16776)require
for fastify integration (#16789)@sentry/cloudflare
as optional peerDependency (#16782)@Cron
decorated tasks (#16792)Work in this release was contributed by @0xbad0c0d3 and @alSergey. Thank you for your contributions!
feat(nuxt): Add Cloudflare Nitro plugin (#15597)
A Nitro plugin for @sentry/nuxt
which initializes Sentry when deployed to Cloudflare (cloudflare-pages
preset).
sentry.server.config.ts
server/plugins
(e.g. server/plugins/sentry-cloudflare-setup.ts
)Add this code in your plugin file
// server/plugins/sentry-cloudflare-setup.ts (filename does not matter)
import { sentryCloudflareNitroPlugin } from '@sentry/nuxt/module/plugins';
export default defineNitroPlugin(
sentryCloudflareNitroPlugin({
dsn: 'https://dsn',
tracesSampleRate: 1.0,
}),
);
or with access to nitroApp
:
// server/plugins/sentry-cloudflare-setup.ts (filename does not matter)
import { sentryCloudflareNitroPlugin } from '@sentry/nuxt/module/plugins';
export default defineNitroPlugin(sentryCloudflareNitroPlugin((nitroApp: NitroApp) => {
// You can access nitroApp here if needed
return ({
dsn: 'https://dsn',
tracesSampleRate: 1.0,
})
}))
vercelAiIntegration
to cloudflare & vercel-edge (#16732)The vercelAiIntegration
is now available as opt-in for the Cloudflare and the Next.js SDK for Vercel Edge.
To use it, add the integration in Sentry.init
Sentry.init({
tracesSampleRate: 1.0,
integrations: [Sentry.vercelAIIntegration()],
});
And enable telemetry for Vercel AI calls
const result = await generateText({
model: openai('gpt-4o'),
experimental_telemetry: {
isEnabled: true,
},
});
The Node.js SDK now includes instrumentation for Postgres.js.
If you're on Fastify v5, you no longer need to call setupFastifyErrorHandler
. It is done automatically by the node SDK. Older versions still rely on calling setupFastifyErrorHandler
.
waitUntil
(#16681)ai
from default server external packages (#16736)Work in this release was contributed by @0xbad0c0d3. Thank you for your contribution!
Enhances CLS (Cumulative Layout Shift) spans by adding attributes detailing the elements that caused layout shifts.
instrumentWorkflowWithSentry
to instrument workflows (#16672)We've added support for Cloudflare Workflows, enabling comprehensive tracing for your workflow runs. This integration uses the workflow's instanceId as the Sentry trace_id and for sampling, linking all steps together. You'll now be able to see full traces, including retries with exponential backoff.
Adds the ability to send logs to Sentry via a pino transport.
errorHandler
option (#16718)CloudEventsContext
compatible with CloudEvent
(#16705)false
(#16695)@opentelemetry/resources
(#16727)Work in this release was contributed by @flaeppe. Thank you for your contribution!
Adds an option to automatically generate a random tunnel route for the Next.js SDK. This helps prevent ad blockers and other tools from blocking Sentry requests by using a randomized path instead of the predictable /monitoring
endpoint.
scope
& client
to getTraceData
(#16633)Adds the ability to pass custom scope
and client
parameters to the getTraceData
function, providing more flexibility when generating trace data for distributed tracing.
x-forwarded-host
and x-forwarded-proto
headers (#16687)@sentry/opentelemetry
dependency (#16677)@sentry/pino-transport
(#16652)safeJoin
usage in console logging integration (#16658)CloudEvent
type compatible (#16661)instrumentation-client.js
file (#16637)vercelAiIntegration
when ai
module is detected (#16565)modulesIntegration
works in more environments (#16566)sendDefaultPii
(#16527)web-vitals
to 5.0.2 (#16492)This release upgrades the web-vitals
library to version 5.0.2. This upgrade could slightly change the collected web vital values and potentially also influence alerts and performance scores in the Sentry UI.
onError
usage (#16547)vercelAiIntegration
(#16551)ignoreLayersType
option to koa integration (#16553)suppressTracing
does not leak when async (#16545)Work in this release was contributed by @eltigerchino. Thank you for your contribution!
TracingInterceptor
(#16501)With this change we stop creating spans for TracingInterceptor
as this interceptor only serves as an internal helper and adds noise for the user.
This feature ships updates to the span names and ops to better match OpenTelemetry. This should make them more easily accessible to the new agents module view we are building.
vercelAIIntegration
from @sentry/node
(#16496)Work in this release was contributed by @agrattan0820. Thank you for your contribution!
ReactRouterServer
integration (#16470)@sentry/react
(#16465)mark
and measure
spans (#16443)This release adds an option to browserTracingIntegration
that lets you ignore
mark
and measure
spans created from the performance.mark(...)
and performance.measure(...)
browser APIs:
Sentry.init({
integrations: [
Sentry.browserTracingIntegration({
ignorePerformanceApiSpans: ['measure-to-ignore', /mark-to-ignore/],
}),
],
});
includeServerName
option (#16442)@sentry/nuxt
external (#16444)@sentry/angular
peer dependencies to add Angular 20 support (#16414)This release adds support for Angular 20 to the Sentry Angular SDK @sentry/angular
.
unregisterOriginalCallbacks
option to browserApiErrorsIntegration
(#16412)Adds an option to opt out of certain resource.*
spans via ignoreResourceSpans
.
For example, to opt out of resource.script
spans:
Sentry.browserTracingIntegration({
ignoreResourceSpans: ['resource.script'],
}),
isEnabled
from all SDKs (#16405)init()
(#16354)captureLog
(#16352)_INTERNAL_captureSerializedLog
(#16387)static/chunks/main-*
files for widenClientFileUpload
(#16406)browserTracingIntegration
code to setup
hook (#16386)@sentry/nuxt
as external in Rollup (#16407)withScope
keeps span active & _getTraceInfoFromScope
works (#16385)Work in this release was contributed by @Xenossolitarius. Thank you for your contribution!
This is a revert of a feature introduced in 9.20.0
with #16240. This feature was causing crashes in firefox, so we are reverting it. We will re-enable this functionality in the future after fixing the crash.
ServerBuild
argument and return (#16336)@fastify/otel
(#16328)OnEvent
decorators (#16306)client
exports to server
and cloudflare
entries (#16341)Work in this release was contributed by @phthhieu. Thank you for your contribution!
The SDK now automatically collects details passed to performance.measure
options.
maxIncomingRequestBodySize
(#16225)aria-label
(#16192)next.route
attribute on root spans (#16297)orgId
option to init
and DSC (sentry-org_id
in baggage) (#16305)opentelemetry-instrumentation-remix
(#16145)cancelled
reason (#16277)@fastify/otel
fork to direct url to allow installing without git (#16287)Work in this release was contributed by @sidx1024. Thank you for your contribution!
We now also publish profiling binaries for Node 24.
import-in-the-middle
to 1.13.1
(#16260)consoleLoggingIntegration
from vercel edge sdk (#16228)@fastify/otel
dependency with pinned Otel v1 deps (#16256)@fastify/otel
(#15542)Add a new plugin makeConfigInjectorPlugin
within our existing vite plugin that updates the global vite config with sentry options
This PR implements consistent sampling across traces as outlined in (#15754)
This PR introduces a new instrumentDurableObjectWithSentry
method to the SDK, which instruments durable objects. We capture both traces and errors automatically.
Prisma integration is enabled by default, it should work for both ESM and CJS.
Adds client-side instrumentation for react router's HydratedRouter
. To enable it, simply replace browserTracingIntegration()
with reactRouterTracingIntegration()
in your client-side init call.
When running your application in ESM mode, there have been scenarios that resulted in the http
/https
emitting duplicate spans for incoming requests. This was apparently caused by us double-wrapping the modules for incoming request isolation.
In order to solve this problem, the modules are no longer monkey patched by us for request isolation. Instead, we register diagnosticschannel hooks to handle request isolation now. While this is generally not expected to break anything, there is one tiny change that _may affect you if you have been relying on very specific functionality:
The ignoreOutgoingRequests
option of httpIntegration
receives the RequestOptions
as second argument. This type is not changed, however due to how the wrapping now works, we no longer pass through the full RequestOptions, but re-construct this partially based on the generated request. For the vast majority of cases, this should be fine, but for the sake of completeness, these are the only fields that may be available there going forward - other fields that may have existed before may no longer be set:
ignoreOutgoingRequests(url: string, {
method: string;
protocol: string;
host: string;
hostname: string; // same as host
path: string;
headers: OutgoingHttpHeaders;
})
SENTRY_RELEASE
from env
(#16201)http.server
spans with 404 status by default (#16205)removeFromDom()
from throwing (#16030)wrapMcpServerWithSentry
from server packages (#16127)Exports the wrapMcpServerWithSentry which is our MCP server instrumentation from all the server packages.
Adds a best effort mechanism to associate handler spans for resource
, tool
and prompt
with the incoming message requests instead of the outgoing SSE response.
ai
ESM patching (#16152)module.register
(#16125)unstable_sentryVitePluginOptions
correctly (#16156)Work in this release was contributed by @AntoineDuComptoirDesPharmacies. Thank you for your contribution!
This PR adds Supabase integration to @sentry/core
, allowing automatic instrumentation of Supabase client operations (database queries and authentication) for performance monitoring and error tracking.
SentryGlobalFilter
(#16066)This PR adds better RPC exception handling to @sentry/nestjs
, preventing application crashes while still capturing errors and warning users when a dedicated filter is needed. The implementation gracefully handles the 'rpc' context type in SentryGlobalFilter
to improve reliability in hybrid applications.
This PR adds trace propagation to @sentry/react-router
by providing utilities to inject trace meta tags into HTML headers and offering a pre-built Sentry-instrumented request handler, improving distributed tracing capabilities across page loads.
feat(node): Add support for winston logger (#15983)
Sentry is adding support for structured logging. In this release we've added support for sending logs to Sentry via the winston logger to the Sentry Node SDK (and SDKs that use the Node SDK under the hood like @sentry/nestjs
). The Logging APIs in the Sentry SDK are still experimental and subject to change.
const winston = require('winston');
const Transport = require('winston-transport');
const transport = Sentry.createSentryWinstonTransport(Transport);
const logger = winston.createLogger({
transports: [transport],
});
feat(core): Add wrapMcpServerWithSentry
to instrument MCP servers from @modelcontextprotocol/sdk
(#16032)
The Sentry SDK now supports instrumenting MCP servers from the @modelcontextprotocol/sdk
package. Compatible with versions ^1.9.0
of the @modelcontextprotocol/sdk
package.
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
// Create an MCP server
const server = new McpServer({
name: 'Demo',
version: '1.0.0',
});
// Use the instrumented server in your application
const instrumentedServer = Sentry.wrapMcpServerWithSentry(server);
feat(core): Move console integration into core and add to cloudflare/vercel-edge (#16024)
Console instrumentation has been added to @sentry/cloudflare
and @sentry/nextjs
Edge Runtime and is enabled by default. Now calls to the console object will be captured as breadcrumbs for those SDKs.
feat(bun): Support new Bun.serve
APIs (#16035)
Bun 1.2.6
and above have a new Bun.serve
API, which the Bun SDK now supports. The SDK instruments the new routes object that can be used to define routes for the server.
Thanks to @Jarred-Sumner for helping us get this supported!
browserTracingIntegration
(#16042)beforeSendLog
after we process log (#16019)unstable_sentryVitePluginOptions
to cli instance (#16033)feat(feedback): Implement highlighting and hiding controls for screenshots (#15951)
The Sentry SDK now supports highlighting and hiding controls for screenshots in user feedback reports. This functionality is enabled by default.
feat(node): Add ignoreIncomingRequestBody
callback to httpIntegration
(#15959)
The httpIntegration
now supports an optional ignoreIncomingRequestBody
callback that can be used to skip capturing the body of incoming requests.
Sentry.init({
integrations: [
Sentry.httpIntegration({
ignoreIncomingRequestBody: (url, request) => {
return request.method === 'GET' && url.includes('/api/large-payload');
},
}),
],
});
The ignoreIncomingRequestBody
callback receives the URL of the request and should return true
if the body should be ignored.
Logging Improvements
Sentry is adding support for structured logging. In this release we've made a variety of improvements to logging functionality in the Sentry SDKs.
onRequestSpanStart
hook to browser tracing integration (#15979)captureRouterTransitionStart
hook for capturing navigations (#15981)http.request.prefetch: true
attribute (#15980)clientInstrumentationHook
(#15992)SENTRY_DEBUG
env variable (#15972)authToken
type to string
(#15985)Work in this release was contributed by @Page- and @Fryuni. Thank you for your contributions!
http.redirect_count
attribute to browser.redirect
span (#15943)consoleLoggingIntegration
for logs (#15955)turbopack
as tag (#15928)sentryHandleRequest
(#15787)module
instead of require
for CJS check (#15927)ErrorBoundary
wrapper (#15930)sentry.previous_trace
span attribute (#15957)3.2.4
(#15909)feat: Add support for logs
beforeSendLog
(#15814)All JavaScript SDKs other than @sentry/cloudflare
and @sentry/deno
now support sending logs via dedicated methods as part of Sentry's upcoming logging product.
Logging is gated by an experimental option, _experiments.enableLogs
.
Sentry.init({
dsn: 'PUBLIC_DSN',
// `enableLogs` must be set to true to use the logging features
_experiments: { enableLogs: true },
});
const { trace, debug, info, warn, error, fatal, fmt } = Sentry.logger;
trace('Starting database connection', { database: 'users' });
debug('Cache miss for user', { userId: 123 });
error('Failed to process payment', { orderId: 'order_123', amount: 99.99 });
fatal('Database connection pool exhausted', { database: 'users', activeConnections: 100 });
// Structured logging via the `fmt` helper function. When you use `fmt`, the string template and parameters are sent separately so they can be queried independently in Sentry.
info(fmt(`Updated profile for user ${userId}`));
warn(fmt(`Rate limit approaching for endpoint ${endpoint}. Requests: ${requests}, Limit: ${limit}`));
With server-side SDKs like @sentry/node
, @sentry/bun
or server-side of @sentry/nextjs
or @sentry/sveltekit
, you can do structured logging without needing the fmt
helper function.
const { info, warn } = Sentry.logger;
info('User %s logged in successfully', [123]);
warn('Failed to load user %s data', [123], { errorCode: 404 });
To filter logs, or update them before they are sent to Sentry, you can use the _experiments.beforeSendLog
option.
feat(browser): Add diagnoseSdkConnectivity()
function to programmatically detect possible connectivity issues (#15821)
The diagnoseSdkConnectivity()
function can be used to programmatically detect possible connectivity issues with the Sentry SDK.
const result = await Sentry.diagnoseSdkConnectivity();
The result will be an object with the following properties:
"no-client-active"
: There was no active client when the function was called. This possibly means that the SDK was not initialized yet."sentry-unreachable"
: The Sentry SaaS servers were not reachable. This likely means that there is an ad blocker active on the page or that there are other connection issues.undefined
: The SDK is working as expected.SDK Tracing Performance Improvements for Node SDKs
dropUndefinedKeys
(#15796)dropUndefinedKeys
for spanToJSON
calls (#15792)SentryError
for PromiseBuffer control flow (#15822)dropUndefinedKeys
in SpanExporter (#15794)SentryError
for event processing control flow (#15823)dropUndefinedKeys
in Node SDK init (#15797)We've been hard at work making performance improvements to the Sentry Node SDKs (@sentry/node
, @sentry/aws-serverless
, @sentry/nestjs
, etc.). We've seen that upgrading from 9.7.0
to 9.10.0
leads to 30-40% improvement in request latency for HTTP web-server applications that use tracing with high sample rates. Non web-server applications and non-tracing applications will see smaller improvements.
rrweb
to 2.35.0
(#15825)3.2.3
(#15829)feat(nextjs): Support instrumentation-client.ts
(#15705)
Next.js recently added a feature to support client-side (browser) instrumentation via a instrumentation-client.ts
file.
To be forwards compatible, the Sentry Next.js SDK will now pick up instrumentation-client.ts
files even on older Next.js versions and add them to your client bundles.
It is suggested that you either rename your sentry.client.config.ts
file to instrumentation-client.ts
, or if you already happen to have a instrumentation-client.ts
file move the contents of sentry.client.config.ts
to instrumentation-client.ts
.
feat(browser): Add previous_trace
span links (#15569)
The @sentry/browser
SDK and SDKs based on @sentry/browser
now emits a link from the first root span of a newly started trace to the root span of a previously started trace. You can control this feature via an option in browserTracingIntegration()
:
Sentry.init({
dsn: 'your-dsn-here'
integrations: [
Sentry.browserTracingIntegration({
// Available settings:
// - 'in-memory' (default): Stores previous trace information in memory
// - 'session-storage': Stores previous trace information in the browser's `sessionStorage`
// - 'off': Disable storing and sending previous trace information
linkPreviousTrace: 'in-memory',
}),
],
});
feat(browser): Add logger.X
methods to browser SDK (#15763)
For Sentry's upcoming logging product, the SDK now supports sending logs via dedicated methods.
Sentry.init({
dsn: 'your-dsn-here',
_experiments: {
enableLogs: true, // This is required to use the logging features
},
});
Sentry.logger.info('This is a trace message', { userId: 123 });
// See PR for better documentation
Please note that the logs product is still in early access. See the link above for more information.
parseStringToURL
method (#15768)dropUndefinedKeys
(#15760)shouldHandleError
(#15771)addNonEnumerableProperty
(#15766)dropUndefinedKeys()
(#15757)dropUndefinedKeys()
(#15781)res.end
before passing to Proxy (#15776)eventFilters
integration (#15752)captureLog
method (#15717)sentryHandleError
(#15726)fatal
level for unhandled rejections in strict
mode (#15720)feat(tanstackstart): Add @sentry/tanstackstart-react
package and make @sentry/tanstackstart
package a utility package (#15629)
Since TanStack Start is supposed to be a generic framework that supports libraries like React and Solid, the @sentry/tanstackstart
SDK package was renamed to @sentry/tanstackstart-react
to reflect that the SDK is specifically intended to be used for React TanStack Start applications.
Note that the TanStack Start SDK is still in alpha status and may be subject to breaking changes in non-major package updates.
fill
only patches functions (#15632)pageExtensions
when looking for instrumentation file (#15701)options
(#15610)Work in this release was contributed by @angelikatyborska and @nwalters512. Thank you for your contributions!
We found some issues with the new feedback screenshot annotation where screenshots are not being generated properly. Due to this issue, we are reverting the feature.
4.34.9
(#15589)@sentry/remix/cloudflare
(#15599)Work in this release was contributed by @msurdi-a8c, @namoscato, and @rileyg98. Thank you for your contributions!
@sentry/cli
from 2.41.1 to 2.42.2 (#15510)@sentry/webpack-plugin
from 3.1.2 to 3.2.1 (#15512)use client
directive to client SDK entrypoints (#15575)AsyncLocalStorage
async context strategy is used in Cloudflare Pages (#15557)@cloudflare/workers-types
an optional peer dependency (#15554)onRequestError
in version 15 (#15553)undefined
transport to be passed in (#15560)With this release we're publishing two new SDKs in experimental alpha stage:
For details please refer to the README
For details please refer to the README
This PR adds support for Shopify Hydrogen applications running on MiniOxygen runtime.
forceTransaction
to trpc middleware options (#15519)inboundFiltersIntegration
to eventFiltersIntegration
(#15434)allowUrls
and denyUrls
for linked and aggregate exceptions (#15521)process
check when flushing events (#15516)Work in this release was contributed by @GerryWilko and @leoambio. Thank you for your contributions!
This release adds full tracing support for Express v5, and improves tracing support for Nest.js 11 (which uses Express v5) in the Nest.js SDK.
This release adds support for deploying SvelteKit applications to Cloudflare Pages. A docs update with updated instructions will follow shortly. Until then, you can give this a try by setting up the SvelteKit SDK as usual and then following the instructions outlined in the PR.
Thank you @SG60 for contributing this feature!
addLink(s)
to Sentry span (#15452)enableNitroErrorHandler
to server options (#15444)addLink(s)
to span (#15387)links
to span options (#15403)performance.measure
spans have a positive duration (#15415)gmo
error to Inbound Filters (#15432)http.client
span descriptions don't contain query params or fragments (#15404)@opentelemetry/instrumentation
(#15419)SentryNuxtServerOptions
type for server init (#15441)Work in this release was contributed by @6farer, @dgavranic and @SG60. Thank you for your contributions!
graphqlClientIntegration
(#13783)vite
import (#15371)Work in this release was contributed by @Zen-cronic and @filips-alpe. Thank you for your contribution!
Version 9.0.0
marks a release of the Sentry JavaScript SDKs that contains breaking changes.
The goal of this release is to trim down on unused and potentially confusing APIs, prepare the SDKs for future framework versions to build deeper instrumentation, and remove old polyfills to reduce the packages' size.
Please carefully read through the migration guide in the Sentry docs on how to upgrade from version 8 to version 9. Make sure to select your specific platform/framework in the top left corner: https://docs.sentry.io/platforms/javascript/migration/v8-to-v9/
A comprehensive migration guide outlining all changes for all the frameworks can be found within the Sentry JavaScript SDK Repository: https://github.com/getsentry/sentry-javascript/blob/develop/MIGRATION.md
~5.0.0
(#14758)nitro-utils
package (#14998)sendDefaultPii: true
(#15084)autoSessionTracking
option (#14802)enableTracing
(#15078)getCurrentHub()
, Hub
, and getCurrentHubShim()
(#15122)spanId
from propagation context (#14733)>=18
as minimum supported version (#14749)captureUserFeedback
method (#14820)normalizedRequest
to samplingContext
(#14902)beforeSendSpan
and disallow returning null
(#14831)BAGGAGE_HEADER_NAME
export (#14785)TransactionNamingScheme
type (#14865)addOpenTelemetryInstrumentation
method (#14792)arrayify
method (#14782)debugIntegration
and sessionTimingIntegration
(#14747)flatten
method (#14784)getDomElement
method (#14797)makeFifoCache
method (#14786)memoBuilder
export & WeakSet
fallback (#14859)transactionContext
from samplingContext
(#14904)urlEncode
method (#14783)Request
type (#14858)Client
interface & deprecate BaseClient
(#14800)event
as argument for recordDroppedEvent
(#14999)requestDataIntegration
(#14898)hasTracingEnabled
to consider empty trace config (#14857)requestDataIntegration
handling (#14806)<=3.x
(#15032)nestIntegration
into nest sdk and remove setupNestErrorHandler
(#14751)@WithSentry
decorator (#14762)SentryService
(#14759)experimental_captureRequestError
(#14607)processThreadBreadcrumbIntegration
(#14666)registerEsmLoaderHooks
(#15002)1.63.0
(#15030)getNumberOfUrlSegments
method (#14744)ErrorBoundary
componentStack
type (#14742)autoInstrumentRemix
option (#15074)--import
setup and add autoInjectServerSentry
(#14862)sentrySolidStartVite
(#15143)fetchProxyScriptNonce
option (#15123)@sentry/utils
package (#14830)vueIntegration
's tracingOptions
option (#14856)"update"
spans for component tracking by default (#14602)vercelAIIntegration
to VercelAI
(#15298)logError
from vueIntegration
(#14958)ReportDialogOptions
(#14861)captureConsoleIntegration
as handled: true
by default (#14734)shutdownTimeout
option type from core to node (#15217)Scope
type interface in favor of using Scope
class (#14721)import-in-the-middle
to 1.12.0
(#14796)SentryNodeServerlessSDKv9
(#14927)user.ip_address
explicitly to {{auto}}
(#15008)inheritOrSampleWith
helper to traceSampler
(#15277)hasTracingEnabled
to hasSpansEnabled
(#15309)SpanJSON
type (#14693)@sentry/deno
(#15014)deno.land
(#15016)SentryTracingInterceptor
, SentryGlobalGraphQLFilter
, SentryGlobalGenericFilter
(#14761)sourcemaps.disable
to webpack plugin (#15109)processSessionIntegration
(#15081)vercelAIIntegration
export (#15318)worker_threads
(#15105)silent
, errorHandler
, release
to SourceMapsOptions
(#15246)@sentry-internal/node-cpu-profiler
(#15208)autoInjectServerSentry: 'experimental_dynamic-import
(#14863)__esModule
properties in CJS modules when there is a default export (#15018)parentSampleRate
to tracesSampler
(#15024)browserPerformanceTimeOrigin
side-effects (#14025)startSpanManual
(#14901)startSpan
(#14900)sendDefaultPii
for IP collection in requestDataIntegration
(#15125)waitUntil
in captureRequestError
(#15146)__span
property into breadcrumbs (#14798)release
from ANR sessions (#15138)browserTracingIntegration
(#14959)supportsHistory
check & history usage (#14696)Work in this release was contributed by @aloisklink, @arturovt, @aryanvdesh, @benjick, @chris-basebone, @davidturissini, @GrizliK1988, @jahands, @jrandolf, @kunal-511, @maximepvrt, @maxmaxme, @mstrokin, @nathankleyn, @nwalters512, @tannerlinsley, @tjhiggins, and @Zen-cronic. Thank you for your contributions!
This is an alpha release of the upcoming major release of version 9. This release does not yet entail a comprehensive changelog as version 9 is not yet stable.
For this release's iteration of the migration guide, see the Migration Guide as per 9.0.0-alpha.2
.
Please note that the migration guide is work in progress and subject to change.
This is an alpha release of the upcoming major release of version 9. This release does not yet entail a comprehensive changelog as version 9 is not yet stable.
For this release's iteration of the migration guide, see the Migration Guide as per 9.0.0-alpha.1
.
Please note that the migration guide is work in progress and subject to change.
This is an alpha release of the upcoming major release of version 9. This release does not yet entail a comprehensive changelog as version 9 is not yet stable.
For this release's iteration of the migration guide, see the Migration Guide as per 9.0.0-alpha.0
.
Please note that the migration guide is work in progress and subject to change.
A full list of changes in the 8.x
release of the SDK can be found in the 8.x Changelog.
A full list of changes in the 7.x
release of the SDK can be found in the 7.x Changelog.
A full list of changes in the 6.x
release of the SDK can be found in the 6.x Changelog.
A full list of changes in the 5.x
release of the SDK can be found in the 5.x Changelog.
A full list of changes in the 4.x
release of the SDK can be found in the 4.x Changelog.