@sentry/nextjs
Advanced tools
Changelog
9.40.0
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!
Changelog
9.39.0
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!
Changelog
9.37.0
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!
Changelog
9.36.0
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:
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!
Changelog
9.35.0
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!
Changelog
9.34.0
feat(nuxt): Add Cloudflare Nitro plugin (#15597)
A Nitro plugin for @sentry/nuxt
which initializes Sentry when deployed to Cloudflare (cloudflare-pages
preset).
Remove the previous server config file: sentry.server.config.ts
Add a plugin in 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,
})
}))