[go: up one dir, main page]

Skip to content

Commit

Permalink
chore: Add ability to disable Sentry source maps (#17699)
Browse files Browse the repository at this point in the history
* chore: Remove Sentry source maps

* Using .env to control Sentry source maps

* Trying with sourcemaps property

* Turned silent off for testing

* Completely turned off devtool
  • Loading branch information
keithwillcode authored Nov 22, 2024
1 parent 040adb2 commit cd24067
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ NEXT_PUBLIC_SENDGRID_SENDER_NAME=
# Used for capturing exceptions and logging messages
NEXT_PUBLIC_SENTRY_DSN=
SENTRY_DEBUG=
SENTRY_DISABLE_CLIENT_SOURCE_MAPS=
SENTRY_DISABLE_SERVER_SOURCE_MAPS=
SENTRY_MAX_SPANS=
SENTRY_TRACES_SAMPLE_RATE=

Expand Down Expand Up @@ -414,4 +416,4 @@ NEXT_PUBLIC_WEBSITE_TERMS_URL=
NEXT_PUBLIC_LOGGER_LEVEL=

# Used to use Replexica SDK, a tool for real-time AI-powered localization
REPLEXICA_API_KEY=
REPLEXICA_API_KEY=
10 changes: 9 additions & 1 deletion apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const nextConfig = {
locales: ["en"],
localeDetection: false,
},
productionBrowserSourceMaps: false,
productionBrowserSourceMaps: process.env.SENTRY_DISABLE_CLIENT_SOURCE_MAPS === "0",
/* We already do type check on GH actions */
typescript: {
ignoreBuildErrors: !!process.env.CI,
Expand Down Expand Up @@ -223,6 +223,10 @@ const nextConfig = {
},
webpack: (config, { webpack, buildId, isServer }) => {
if (isServer) {
if (process.env.SENTRY_DISABLE_SERVER_SOURCE_MAPS === "1") {
config.devtool = false;
}

// Module not found fix @see https://github.com/boxyhq/jackson/issues/1535#issuecomment-1704381612
config.plugins.push(
new webpack.IgnorePlugin({
Expand Down Expand Up @@ -667,6 +671,10 @@ if (!!process.env.NEXT_PUBLIC_SENTRY_DSN) {
hideSourceMaps: true,
// disable source map generation for the server code
disableServerWebpackPlugin: !!process.env.SENTRY_DISABLE_SERVER_WEBPACK_PLUGIN,
silent: false,
sourcemaps: {
disable: process.env.SENTRY_DISABLE_SERVER_SOURCE_MAPS === "1",
},
})
);
}
Expand Down
2 changes: 2 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@
"SENDGRID_API_KEY",
"SENDGRID_EMAIL",
"SENDGRID_SYNC_API_KEY",
"SENTRY_DISABLE_CLIENT_SOURCE_MAPS",
"SENTRY_DISABLE_SERVER_SOURCE_MAPS",
"SENTRY_DISABLE_SERVER_WEBPACK_PLUGIN",
"SLACK_CLIENT_ID",
"SLACK_CLIENT_SECRET",
Expand Down

0 comments on commit cd24067

Please sign in to comment.