Skip to content

Scheduling infrastructure for absolutely everyone.

chore: Add ability to disable Sentry source maps (#17699)

Keith Williamscd24067f1717
diff --git a/.env.example b/.env.example
index 83764f27a8f..84472e5fe87 100644
--- a/.env.example
+++ b/.env.example
@@ -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=
@@ -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=
\ No newline at end of file
+REPLEXICA_API_KEY=
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index 94529ec1f55..095dad461df 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -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,
@@ -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({
@@ -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",
+ },
})
);
}
diff --git a/turbo.json b/turbo.json
index 90eef88a9a8..4ed07ff9936 100644
--- a/turbo.json
+++ b/turbo.json
@@ -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",