@sentry/react
Advanced tools
Changelog
9.16.0
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)Changelog
9.15.0
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!
Changelog
9.14.0
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.
Changelog
9.13.0
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)Changelog
9.12.0
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!
Changelog
9.11.0
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)Changelog
9.10.0
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.