[sentry/nextjs] sentry/tracing adds 30kb, can we opt-out ?
See original GitHub issueProblem Statement
Following the sentry/nextjs recommended approach, it’s difficult to opt-out from tracing in the browser.
The sentry/tracing adds more or less 30kb to the browser final bundle which is a hard blocker in some circumstances.
Here’s a tree map taken with the recommended approach and tested with @sentry/nextjs 6.18.2
Solution Brainstorm
I was able to remove the sentry/tracing from the browser, by importing sentry/react rather than sentry/nextjs
// import { init as sentryInit } from '@sentry/nextjs';
import { init as sentryInit } from '@sentry/react';
sentryInit({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// tracesSampleRate: 1.0,
});
That reduced the bundle from 103kb to 73kb
The setup is https://github.com/belgattitude/nextjs-monorepo-example/pull/1409
Is there any drawbacks or risks to this approach (apart from not sending traces) ?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Next.js - Sentry Documentation
On this page, we get you up and running with Sentry's SDK, so that it will automatically report errors and exceptions in your...
Read more >Shu on Twitter: "If you are using Sentry in Next.js, make sure to ...
We have a utility `isLoggedIn()` to check if the current visitor is logged in by reading `document.cookie`. And it turned out to be...
Read more >Integrate your Next.js site with Sentry - RudderStack.com
RudderStack's open source JavaScript SDK allows you to integrate RudderStack with your Next.js site to track event data and automatically send it to...
Read more >Exclude nextjs api url from sentry events - Stack Overflow
I did a small research and it seems that there is an array of urls you can exclude from being tracked. It's called...
Read more >Sentry Expands Code Observability for Next.js - Business Wire
Next.js is one of the fastest-growing React frameworks because it offers built-in search engine optimization, focuses on web app performance ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@AbhiPrasad congrats it works perfect 💯 Thanks a lot
PS: Note for others, simply add this in next.config.js
Closing this for now since we’ve released v7: https://github.com/getsentry/sentry-javascript/releases/tag/7.0.0