Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@sentry/nextjs
Advanced tools
The @sentry/nextjs package is a JavaScript SDK for Sentry that provides error tracking and performance monitoring specifically tailored for Next.js applications. It helps developers to automatically capture exceptions, track performance issues, and improve the reliability of their Next.js applications.
Automatic Error Tracking
Automatically captures unhandled exceptions and errors in the Next.js application and sends them to Sentry for monitoring and analysis.
import * as Sentry from '@sentry/nextjs';
Sentry.init({ dsn: 'YOUR_DSN' });
Performance Monitoring
Enables performance monitoring to track the performance of server-side and client-side Next.js operations, providing insights into slow transactions and bottlenecks.
import * as Sentry from '@sentry/nextjs';
Sentry.init({
dsn: 'YOUR_DSN',
tracesSampleRate: 1.0
});
Custom Error Reporting
Allows developers to manually report custom errors or exceptions to Sentry, giving them control over what gets reported.
import * as Sentry from '@sentry/nextjs';
Sentry.captureException(new Error('Custom error message'));
Release Health Tracking
Tracks the health of releases by monitoring error rates and issues that affect end-users, helping developers to understand the impact of new releases.
import * as Sentry from '@sentry/nextjs';
Sentry.init({
dsn: 'YOUR_DSN',
release: 'my-project-name@1.0.0'
});
Bugsnag provides error monitoring for JavaScript applications, including Next.js. It offers similar features to Sentry, such as automatic error detection, custom error reporting, and release tracking. However, Bugsnag's interface and integrations may differ from Sentry's.
Raygun offers real-time error tracking and crash reporting for JavaScript applications. It includes features like user tracking, performance monitoring, and deployment tracking. Raygun's focus on user-centric metrics and detailed diagnostics provides a different perspective compared to Sentry.
LogRocket is a frontend application monitoring solution that combines session replay, performance monitoring, and error tracking. Unlike Sentry, which focuses on error and performance data, LogRocket provides insights into user interactions and experiences by recording user sessions.
See the Official Sentry Next.js SDK Docs to get started.
Currently, the minimum supported version of Next.js is 13.2.0
.
To get started installing the SDK, use the Sentry Next.js Wizard by running the following command in your terminal or read the Getting Started Docs:
npx @sentry/wizard@latest -i nextjs
The wizard will prompt you to log in to Sentry. After the wizard setup is completed, the SDK will automatically capture unhandled errors, and monitor performance.
To set context information or to send manual events, you can use @sentry/nextjs
as follows:
import * as Sentry from '@sentry/nextjs';
// Set user information, as well as tags and further extras
Sentry.setTag('user_mode', 'admin');
Sentry.setUser({ id: '4711' });
Sentry.setContext('application_area', { location: 'checkout' });
// Add a breadcrumb for future events
Sentry.addBreadcrumb({
message: '"Add to cart" clicked',
// ...
});
// Capture exceptions or messages
Sentry.captureException(new Error('Oh no.'));
Sentry.captureMessage('Hello, world!');
8.26.0
feat(node): Add fsInstrumentation
(#13291)
This release adds fsIntegration
, an integration that instruments the fs
API to the Sentry Node SDK. The
integration creates spans with naming patterns of fs.readFile
, fs.unlink
, and so on.
This integration is not enabled by default and needs to be registered in your Sentry.init
call. You can configure
via options whether to include path arguments or error messages as span attributes when an fs call fails:
Sentry.init({
integrations: [
Sentry.fsIntegration({
recordFilePaths: true,
recordErrorMessagesAsSpanAttributes: true,
}),
],
});
WARNING: This integration may add significant overhead to your application. Especially in scenarios with a lot of file I/O, like for example when running a framework dev server, including this integration can massively slow down your application.
feat(browser): Add spotlightBrowser integration (#13263)
feat(browser): Allow sentry in safari extension background page (#13209)
feat(browser): Send CLS as standalone span (experimental) (#13056)
feat(core): Add OpenTelemetry-specific getTraceData
implementation (#13281)
feat(nextjs): Always add browserTracingIntegration
(#13324)
feat(nextjs): Always transmit trace data to the client (#13337)
feat(nextjs): export SentryBuildOptions (#13296)
feat(nextjs): Update experimental_captureRequestError
to reflect RequestInfo.path
change in Next.js canary
(#13344)
feat(nuxt): Always add tracing meta tags (#13273)
feat(nuxt): Set transaction name for server error (#13292)
feat(replay): Add a replay-specific logger (#13256)
feat(sveltekit): Add bundle size optimizations to plugin options (#13318)
feat(sveltekit): Always add browserTracingIntegration (#13322)
feat(tracing): Make long animation frames opt-out (#13255)
fix(astro): Correctly extract request data (#13315)
fix(astro): Only track access request headers in dynamic page requests (#13306)
fix(nuxt): Add import line for disabled autoImport
(#13342)
fix(nuxt): Add vue to excludeEsmLoaderHooks array (#13346)
fix(opentelemetry): Do not overwrite http span name if kind is internal (#13282)
fix(remix): Ensure origin
is correctly set for remix server spans (#13305)
Work in this release was contributed by @MonstraG, @undead-voron and @Zen-cronic. Thank you for your contributions!
FAQs
Official Sentry SDK for Next.js
The npm package @sentry/nextjs receives a total of 1,138,409 weekly downloads. As such, @sentry/nextjs popularity was classified as popular.
We found that @sentry/nextjs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.