forked from QuivrHQ/quivr
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sentry): added only if env variable set
- Loading branch information
1 parent
315411f
commit f9b3eba
Showing
4 changed files
with
109 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,43 @@ | ||
const nextConfig = {}; | ||
|
||
module.exports = nextConfig; | ||
|
||
|
||
// // 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: "quivr-0f", | ||
// project: "javascript-nextjs", | ||
// }, | ||
// { | ||
// // 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, | ||
// } | ||
// ); | ||
// Check if the SENTRY_DSN environment variable is defined | ||
if (process.env.SENTRY_DSN) { | ||
// SENTRY_DSN exists, include Sentry configuration | ||
const { withSentryConfig } = require("@sentry/nextjs"); | ||
|
||
module.exports = withSentryConfig( | ||
nextConfig, | ||
{ | ||
// For all available options, see: | ||
// https://github.com/getsentry/sentry-webpack-plugin#options | ||
|
||
// Suppresses source map uploading logs during build | ||
silent: true, | ||
|
||
org: "quivr-0f", | ||
project: "javascript-nextjs", | ||
}, | ||
{ | ||
// 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, | ||
} | ||
); | ||
} else { | ||
// SENTRY_DSN does not exist, export nextConfig without Sentry | ||
module.exports = nextConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
// // 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"; | ||
|
||
// // Get the DSN from the environment variable | ||
// const SENTRY_DSN = process.env.SENTRY_DSN; | ||
|
||
// // Only initialize Sentry if the DSN is set | ||
// if (SENTRY_DSN) { | ||
// Sentry.init({ | ||
// dsn: SENTRY_DSN, | ||
|
||
// // 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.Replay({ | ||
// // Additional Replay configuration goes in here, for example: | ||
// maskAllText: true, | ||
// blockAllMedia: true, | ||
// }), | ||
// ], | ||
// }); | ||
// } else { | ||
// console.log("Sentry is not initialized as SENTRY_DSN is not set"); | ||
// } | ||
// 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"; | ||
|
||
// Get the DSN from the environment variable | ||
const SENTRY_DSN = process.env.SENTRY_DSN; | ||
|
||
// Only initialize Sentry if the DSN is set | ||
if (SENTRY_DSN) { | ||
Sentry.init({ | ||
dsn: SENTRY_DSN, | ||
|
||
// 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.Replay({ | ||
// Additional Replay configuration goes in here, for example: | ||
maskAllText: true, | ||
blockAllMedia: true, | ||
}), | ||
], | ||
}); | ||
} else { | ||
console.log("Sentry is not initialized as SENTRY_DSN is not set"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
// import * as Sentry from "@sentry/nextjs"; | ||
import * as Sentry from "@sentry/nextjs"; | ||
|
||
// // Get the DSN from the environment variable | ||
// const SENTRY_DSN = process.env.SENTRY_DSN; | ||
// Get the DSN from the environment variable | ||
const SENTRY_DSN = process.env.SENTRY_DSN; | ||
|
||
// // Only initialize Sentry if the DSN is set | ||
// if (SENTRY_DSN) { | ||
// Sentry.init({ | ||
// dsn: SENTRY_DSN, | ||
// Only initialize Sentry if the DSN is set | ||
if (SENTRY_DSN) { | ||
Sentry.init({ | ||
dsn: SENTRY_DSN, | ||
|
||
// // Adjust this value in production, or use tracesSampler for greater control | ||
// tracesSampleRate: 1, | ||
// 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, | ||
// }); | ||
// } else { | ||
// console.log("Sentry is not initialized on the server as SENTRY_DSN is not set"); | ||
// } | ||
// Setting this option to true will print useful information to the console while you're setting up Sentry. | ||
debug: false, | ||
}); | ||
} else { | ||
console.log("Sentry is not initialized on the server as SENTRY_DSN is not set"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
// import * as Sentry from "@sentry/nextjs"; | ||
import * as Sentry from "@sentry/nextjs"; | ||
|
||
// // Get the DSN from the environment variable | ||
// const SENTRY_DSN = process.env.SENTRY_DSN; | ||
// Get the DSN from the environment variable | ||
const SENTRY_DSN = process.env.SENTRY_DSN; | ||
|
||
// // Only initialize Sentry if the DSN is set | ||
// if (SENTRY_DSN) { | ||
// Sentry.init({ | ||
// dsn: SENTRY_DSN, | ||
// Only initialize Sentry if the DSN is set | ||
if (SENTRY_DSN) { | ||
Sentry.init({ | ||
dsn: SENTRY_DSN, | ||
|
||
// // Adjust this value in production, or use tracesSampler for greater control | ||
// tracesSampleRate: 1, | ||
// 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, | ||
// }); | ||
// } else { | ||
// console.log("Sentry is not initialized on the server as SENTRY_DSN is not set"); | ||
// } | ||
// Setting this option to true will print useful information to the console while you're setting up Sentry. | ||
debug: false, | ||
}); | ||
} else { | ||
console.log("Sentry is not initialized on the server as SENTRY_DSN is not set"); | ||
} |