@sentry/utils
Advanced tools
Changelog
8.6.0
feat(metrics): Add timings
method to metrics (#12226)
This introduces a new method, metrics.timing()
, which can be used in two ways:
second
as unit:Sentry.metrics.timing('myMetric', 100);
const returnValue = Sentry.metrics.timing('myMetric', measureThisFunction);
feat(react): Add Sentry.reactErrorHandler
(#12147)
This PR introduces Sentry.reactErrorHandler
, which you can use in React 19 as follows:
import * as Sentry from '@sentry/react';
import { hydrateRoot } from 'react-dom/client';
ReactDOM.hydrateRoot(
document.getElementById('root'),
<React.StrictMode>
<App />
</React.StrictMode>,
{
onUncaughtError: Sentry.reactErrorHandler(),
onCaughtError: Sentry.reactErrorHandler((error, errorInfo) => {
// optional callback if users want custom config.
}),
},
);
For more details, take a look at the PR. Our documentation will be updated soon!
Changelog
8.5.0
This release adds support for React 19 in the @sentry/react
SDK package.
@sentry/node/preload
hook (#12213)This release adds a new way to initialize @sentry/node
, which allows you to use the SDK with performance
instrumentation even if you cannot call Sentry.init()
at the very start of your app.
First, run the SDK like this:
node --require @sentry/node/preload ./app.js
Now, you can initialize and import the rest of the SDK later or asynchronously:
const express = require('express');
const Sentry = require('@sentry/node');
const dsn = await getSentryDsn();
Sentry.init({ dsn });
For more details, head over to the PR Description of the new feature. Our docs will be updated soon with a new guide.
startNewTrace
API (#12138)captureFeedback()
(#12216)SerializedSession
in session envelope items (#11979)waitUntil
to defer freezing of Vercel Lambdas (#12133)Module._resolveFilename
in Lambda layer bundle (#12232)ImportInTheMiddle
(#12233)@prisma/instrumentation
to use default import (#12185)inspector
asynchronously (#12231)Changelog
8.4.0
If you are using Next.js version 14.3.0-canary.64
or above, the Sentry Next.js SDK will now trace clientside pageloads
with React Server Components. This means, that client-side errors like
Error: An error occurred in the Server Components render.
, which previously didn't give you much information on how
that error was caused, can now be traced back to a specific error in a server component.
This release guarantees support for Angular 18 with @sentry/angular
.
Changelog
8.3.0
This release improves data quality of spans emitted by Express, Fastify, Connect, Koa, Nest.js and Hapi.
feat(node): Ensure connect spans have better data (#12130)
feat(node): Ensure express spans have better data (#12107)
feat(node): Ensure fastify spans have better data (#12106)
feat(node): Ensure hapi spans have better data (#12140)
feat(node): Ensure koa spans have better data (#12108)
feat(node): Ensure Nest.js spans have better data (#12139)
feat(deps): Bump @opentelemetry/instrumentation-express from 0.38.0 to 0.39.0 (#12079)
feat(node): No-code init via --import=@sentry/node/init
(#11999)
When using Sentry in ESM mode, you can now use Sentry without manually calling init like this:
SENTRY_DSN=https://examplePublicKey@o0.ingest.sentry.io/0 node --import=@sentry/node/init app.mjs
When using CommonJS, you can do:
SENTRY_DSN=https://examplePublicKey@o0.ingest.sentry.io/0 node --require=@sentry/node/init app.js
browserProfilingIntegration
is published to CDN (#12158)node:
prefix for node built-ins (#11895)setTimeout
to avoid e.g. angular change detection (#11924)undefined
values in props (#12131)@prisma/instrumentation
from 5.13.0 to 5.14.0 (#12081)Work in this release contributed by @pboling. Thank you for your contribution!
Changelog
8.2.1
Changelog
8.2.0
beforeSendSpan
hook (#11886)Scope
(#12067)hasTracingEnabled()
if possible (#12066)Changelog
8.1.0
This release mainly fixes a couple of bugs from the initial 8.0.0 release. In addition to the changes below, we updated some initially missed points in our migration guides and documentation.
lastEventId
on isolation scope (#11951) (#12022)awslambda-auto
parseSampleRate
utility function (#12024)eventId
optional and use lastEventId
in report dialog (#12029)Changelog
8.0.0
The Sentry JS SDK team is proud to announce the release of version 8.0.0
of Sentry's JavaScript SDKs - it's been a
long time coming! Thanks to everyone for your patience and a special shout out to the brave souls testing preview builds
and reporting issues - we appreciate your support!
We recommend reading the migration guide docs to find out how to address any breaking changes in your code for your specific platform or framework.
To automate upgrading to v8 as much as possible, use our migration codemod @sentry/migr8
:
npx @sentry/migr8@latest
All deprecations from the v7 cycle, with the exception of getCurrentHub()
, have been removed and can no longer be used
in v8. If you have an advanced Sentry SDK setup, we additionally recommend reading the
in-depth migration guide in our repo which highlights all changes with additional details and
information.
The rest of this changelog highlights the most important (breaking) changes and links to more detailed information.
With v8, we dropped support for several old runtimes and browsers
Node SDKs: The Sentry JavaScript SDK v8 now supports Node.js 14.8.0 or higher. This applies to @sentry/node
and all of our node-based server-side sdks (@sentry/nextjs
, @sentry/remix
, etc.). Furthermore, version 8 now ships
with full support for ESM-based node apps using Node.js 18.19.0 or higher.
Browser SDKs: The browser SDKs now require ES2018+ compatible browsers. New minimum browser versions:
For more details, please see the version support section in our migration guide.
In v8, we support a lot more node-based packages than before. In order to ensure auto-instrumentation works, the SDK now needs to be imported and initialized before any other import in your code.
We recommend creating a new file (e.g. instrumentation.js
) to import and initialize the SDK. Then, import the file on
top of your entry file or detailed instructions, check our updated SDK setup docs
initializing the SDK in v8.
The API around performance monitoring and tracing has been streamlined, and we've added support for more integrations out of the box.
Integrations are now simple functions instead of classes. Class-based integrations have been removed:
// old (v7)
Sentry.init({
integrations: [new Sentry.BrowserTracing()],
});
// new (v8)
Sentry.init({
integrations: [Sentry.browserTracingIntegration()],
});
The following packages have been removed or replaced and will no longer be published: