Skip to content

Commit

Permalink
fix(sentry): sentry Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
yokesh-ks committed Jun 1, 2023
1 parent 28cf935 commit e3347aa
Show file tree
Hide file tree
Showing 7 changed files with 380 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ yarn-error.log*

# vercel
.vercel

# Sentry Auth Token
.sentryclirc
37 changes: 37 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,40 @@ module.exports = (phase, { defaultConfig }) => {
},
};
};

// Injected content via Sentry wizard below

const { withSentryConfig } = require("@sentry/nextjs");

module.exports = withSentryConfig(
module.exports,
{
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options

// Suppresses source map uploading logs during build
silent: true,

org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
},
{
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/

// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,

// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,

// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
tunnelRoute: "/monitoring",

// Hides source maps from generated client bundles
hideSourceMaps: true,

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
}
);
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@emotion/react": "^11.9.3",
"@emotion/styled": "^11.9.3",
"@next/bundle-analyzer": "^12.2.0",
"@sentry/nextjs": "^7.54.0",
"@uimakers/tools-ui": "^1.0.0",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.3.0",
Expand Down Expand Up @@ -51,4 +52,4 @@
"child_process": false,
"os": false
}
}
}
34 changes: 34 additions & 0 deletions sentry.client.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// This file configures the initialization of Sentry on the client.
// The config you add here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from "@sentry/nextjs";

Sentry.init({
dsn: process.env.SENTRY_URL,

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

replaysOnErrorSampleRate: 1.0,

// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,

// You can remove this option if you're not planning to use the Sentry Session Replay feature:
integrations: [
new Sentry.BrowserTracing({
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
}),
new Sentry.Replay({
// Additional Replay configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
});
16 changes: 16 additions & 0 deletions sentry.edge.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
// The config you add here will be used whenever one of the edge features is loaded.
// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from "@sentry/nextjs";

Sentry.init({
dsn: process.env.SENTRY_URL,

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});
15 changes: 15 additions & 0 deletions sentry.server.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This file configures the initialization of Sentry on the server.
// The config you add here will be used whenever the server handles a request.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from "@sentry/nextjs";

Sentry.init({
dsn: process.env.SENTRY_URL,

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});
Loading

1 comment on commit e3347aa

@vercel
Copy link

@vercel vercel bot commented on e3347aa Jun 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

my-tools – ./

my-tools-git-main-yokesh-ks.vercel.app
toolempire.vercel.app
my-tools-yokesh-ks.vercel.app

Please sign in to comment.