From fe838aab17928cca869b440d68564c965ef51881 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Mon, 7 Jun 2021 16:15:46 +0530 Subject: [PATCH 01/16] updated to @sentry/nextjs package --- next.config.js | 56 +-------------- package.json | 6 +- sentry.client.config.js | 15 ++++ sentry.server.config.js | 15 ++++ src/pages/404.js | 7 -- src/pages/_app.tsx | 3 +- src/pages/_error.js | 61 ----------------- src/utils/sentry/index.ts | 45 +----------- yarn.lock | 139 +++++++++++++++++++++++++++++++++++++- 9 files changed, 173 insertions(+), 174 deletions(-) create mode 100644 sentry.client.config.js create mode 100644 sentry.server.config.js delete mode 100644 src/pages/404.js delete mode 100644 src/pages/_error.js diff --git a/next.config.js b/next.config.js index 1b422f0fd..c81e13fad 100644 --- a/next.config.js +++ b/next.config.js @@ -1,67 +1,17 @@ -// Use the SentryWebpack plugin to upload the source maps during build step -const SentryWebpackPlugin = require('@sentry/webpack-plugin'); const withBundleAnalyzer = require('@next/bundle-analyzer')({ enabled: process.env.ANALYZE === 'true', }); const withWorkbox = require('next-with-workbox'); -const { - NEXT_PUBLIC_SENTRY_DSN: SENTRY_DSN, - SENTRY_ORG, - SENTRY_PROJECT, - SENTRY_AUTH_TOKEN, - NODE_ENV, - GITHUB_COMMIT_SHA: COMMIT_SHA, -} = process.env; +const { withSentryConfig } = require('@sentry/nextjs'); -process.env.SENTRY_DSN = SENTRY_DSN; -const basePath = ''; -module.exports = withWorkbox(withBundleAnalyzer({ - productionBrowserSourceMaps: true, +module.exports = withSentryConfig(withWorkbox(withBundleAnalyzer({ future: { webpack5: true, }, - env: { - // Make the COMMIT_SHA available to the client so that Sentry events can be - // marked for the release they belong to. It may be undefined if running - // outside of Vercel - NEXT_PUBLIC_COMMIT_SHA: COMMIT_SHA, - }, workbox: { swSrc: 'src/serviceWorker.js', exclude: ['/manifest.json'], }, - webpack: (config, { isServer, webpack }) => { - if (!isServer) { - config.resolve.alias['@sentry/node'] = '@sentry/browser'; - } - // Define an environment variable so source code can check whether or not - // it's running on the server so we can correctly initialize Sentry - config.plugins.push( - new webpack.DefinePlugin({ - 'process.env.NEXT_IS_SERVER': JSON.stringify( - isServer.toString(), - ), - }), - ); - if ( - false && - SENTRY_DSN && - SENTRY_ORG && - SENTRY_PROJECT && - SENTRY_AUTH_TOKEN && - NODE_ENV === 'production' - ) { - config.plugins.push( - new SentryWebpackPlugin({ - include: '.next', - ignore: ['node_modules'], - stripPrefix: ['webpack://_N_E/'], - urlPrefix: `~${basePath}/_next`, - }), - ); - } - return config; - }, -})); +}))); diff --git a/package.json b/package.json index 428ebd500..bfa7859b3 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,7 @@ "postinstall": "husky install" }, "dependencies": { - "@sentry/browser": "^5.21.3", - "@sentry/integrations": "^5.21.3", - "@sentry/node": "^5.21.3", - "@sentry/types": "^6.6.0", - "@sentry/webpack-plugin": "^1.12.1", + "@sentry/nextjs": "^6.5.1", "@stripe/stripe-js": "^1.13.2", "@typescript-eslint/eslint-plugin": "^4.25.0", "@typescript-eslint/parser": "^4.25.0", diff --git a/sentry.client.config.js b/sentry.client.config.js new file mode 100644 index 000000000..303334ade --- /dev/null +++ b/sentry.client.config.js @@ -0,0 +1,15 @@ +import * as Sentry from '@sentry/nextjs'; + +const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN; + +Sentry.init({ + dsn: SENTRY_DSN, + // We recommend adjusting this value in production, or using tracesSampler + // for finer control + tracesSampleRate: 1.0, + release: 'bada-frame-v' + process.env.npm_package_version, + // ... + // Note: if you want to override the automatic release value, do not set a + // `release` value here - use the environment variable `SENTRY_RELEASE`, so + // that it will also get attached to your source maps +}); diff --git a/sentry.server.config.js b/sentry.server.config.js new file mode 100644 index 000000000..04212e1b5 --- /dev/null +++ b/sentry.server.config.js @@ -0,0 +1,15 @@ +import * as Sentry from '@sentry/nextjs'; + +const SENTRY_DSN = process.env.SENTRY_DSN; + +Sentry.init({ + dsn: SENTRY_DSN, + // We recommend adjusting this value in production, or using tracesSampler + // for finer control + tracesSampleRate: 1.0, + release: 'bada-frame-v' + process.env.npm_package_version, + // ... + // Note: if you want to override the automatic release value, do not set a + // `release` value here - use the environment variable `SENTRY_RELEASE`, so + // that it will also get attached to your source maps +}); diff --git a/src/pages/404.js b/src/pages/404.js deleted file mode 100644 index 423922c80..000000000 --- a/src/pages/404.js +++ /dev/null @@ -1,7 +0,0 @@ -import React from 'react'; -import Error from 'next/error'; - -export default function NotFound() { - // Opinionated: do not record an exception in Sentry for 404 - return ; -} diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 21dd3037a..c13831d36 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -8,7 +8,7 @@ import Head from 'next/head'; import 'bootstrap/dist/css/bootstrap.min.css'; import 'photoswipe/dist/photoswipe.css'; import EnteSpinner from 'components/EnteSpinner'; -import { logError, sentryInit } from '../utils/sentry'; +import { logError } from '../utils/sentry'; import { Workbox } from 'workbox-window'; import { getEndpoint } from 'utils/common/apiUtil'; import { getData, LS_KEYS } from 'utils/storage/localStorage'; @@ -339,7 +339,6 @@ export interface BannerMessage { variant: string; } -sentryInit(); type AppContextType = { showNavBar: (show: boolean) => void; diff --git a/src/pages/_error.js b/src/pages/_error.js deleted file mode 100644 index 741564291..000000000 --- a/src/pages/_error.js +++ /dev/null @@ -1,61 +0,0 @@ -import React from 'react'; -import NextErrorComponent from 'next/error'; -import * as Sentry from '@sentry/node'; - -const MyError = ({ statusCode, hasGetInitialPropsRun, err }) => { - if (!hasGetInitialPropsRun && err) { - // getInitialProps is not called in case of - // https://github.com/vercel/next.js/issues/8592. As a workaround, we pass - // err via _app.js so it can be captured - Sentry.captureException(err); - // Flushing is not required in this case as it only happens on the client - } - - return ; -}; - -MyError.getInitialProps = async ({ res, err, asPath }) => { - const errorInitialProps = await NextErrorComponent.getInitialProps({ - res, - err, - }); - - // Workaround for https://github.com/vercel/next.js/issues/8592, mark when - // getInitialProps has run - errorInitialProps.hasGetInitialPropsRun = true; - - // Running on the server, the response object (`res`) is available. - // - // Next.js will pass an err on the server if a page's data fetching methods - // threw or returned a Promise that rejected - // - // Running on the client (browser), Next.js will provide an err if: - // - // - a page's `getInitialProps` threw or returned a Promise that rejected - // - an exception was thrown somewhere in the React lifecycle (render, - // componentDidMount, etc) that was caught by Next.js's React Error - // Boundary. Read more about what types of exceptions are caught by Error - // Boundaries: https://reactjs.org/docs/error-boundaries.html - - if (err) { - Sentry.captureException(err); - - // Flushing before returning is necessary if deploying to Vercel, see - // https://vercel.com/docs/platform/limits#streaming-responses - await Sentry.flush(2000); - - return errorInitialProps; - } - - // If this point is reached, getInitialProps was called without any - // information about what the error might be. This is unexpected and may - // indicate a bug introduced in Next.js, so record it in Sentry - Sentry.captureException( - new Error(`_error.js getInitialProps missing data at path: ${asPath}`), - ); - await Sentry.flush(2000); - - return errorInitialProps; -}; - -export default MyError; diff --git a/src/utils/sentry/index.ts b/src/utils/sentry/index.ts index 56178e80b..a63f5acbf 100644 --- a/src/utils/sentry/index.ts +++ b/src/utils/sentry/index.ts @@ -1,47 +1,4 @@ -import * as Sentry from '@sentry/browser'; -import { RewriteFrames, CaptureConsole } from '@sentry/integrations'; - -export const sentryInit = () => { - if (process.env.NEXT_PUBLIC_SENTRY_DSN) { - const integrations = []; - if ( - process.env.NEXT_IS_SERVER === 'true' && - process.env.NEXT_PUBLIC_SENTRY_SERVER_ROOT_DIR - ) { - // For Node.js, rewrite Error.stack to use relative paths, so that source - // maps starting with ~/_next map to files in Error.stack with path - // app:///_next - integrations.push( - new RewriteFrames({ - iteratee: (frame) => { - frame.filename = frame.filename.replace( - process.env.NEXT_PUBLIC_SENTRY_SERVER_ROOT_DIR, - 'app:///', - ); - frame.filename = frame.filename.replace( - '.next', - '_next', - ); - return frame; - }, - }), - ); - } - integrations.push( - new CaptureConsole({ - levels: ['error'], - }), - ); - - Sentry.init({ - enabled: process.env.NODE_ENV === 'production', - environment: process.env.NODE_ENV, - integrations, - dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, - attachStacktrace: true, - }); - } -}; +import * as Sentry from '@sentry/nextjs'; export const logError = (e: any, msg?: string) => { Sentry.captureException(e, { diff --git a/yarn.lock b/yarn.lock index 1719b3b8b..23aad94f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1166,6 +1166,16 @@ estree-walker "^1.0.1" picomatch "^2.2.2" +"@sentry/browser@6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.5.1.tgz#9a6ed5607b3b0f4e83f38720e3e202906f8c5bdb" + integrity sha512-iVLCdEFwsoWAzE/hNknexPQjjDpMQV7mmaq9Z1P63bD6MfhwVTx4hG4pHn8HEvC38VvCVf1wv0v/LxtoODAYXg== + dependencies: + "@sentry/core" "6.5.1" + "@sentry/types" "6.5.1" + "@sentry/utils" "6.5.1" + tslib "^1.9.3" + "@sentry/browser@^5.21.3": version "5.30.0" resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.30.0.tgz#c28f49d551db3172080caef9f18791a7fd39e3b3" @@ -1176,6 +1186,18 @@ "@sentry/utils" "5.30.0" tslib "^1.9.3" +"@sentry/cli@^1.63.1": + version "1.65.0" + resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.65.0.tgz#bdf613e3a4359b9e282b968a7387d5dca361931b" + integrity sha512-N5riXQ7H+tGMQ+VCEVJI8Qy4FoVDvDw7jmFYbcn5xLWTyM+g0rVEm7kUL33zZENxdL2plNlepklPU+rFk4KDRw== + dependencies: + https-proxy-agent "^5.0.0" + mkdirp "^0.5.5" + node-fetch "^2.6.0" + npmlog "^4.1.2" + progress "^2.0.3" + proxy-from-env "^1.1.0" + "@sentry/cli@^1.64.1": version "1.66.0" resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.66.0.tgz#0526f1bc1c0570ce72ed817190af92f3b63a2e9a" @@ -1199,6 +1221,17 @@ "@sentry/utils" "5.30.0" tslib "^1.9.3" +"@sentry/core@6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.5.1.tgz#c8b6c3ed86ed07b193c95d599c1b9a4a161e500e" + integrity sha512-Mh3sl/iUOT1myHmM6RlDy2ARzkUClx/g4DAt1rJ/IpQBOlDYQraplXSIW80i/hzRgQDfwhwgf4wUa5DicKBjKw== + dependencies: + "@sentry/hub" "6.5.1" + "@sentry/minimal" "6.5.1" + "@sentry/types" "6.5.1" + "@sentry/utils" "6.5.1" + tslib "^1.9.3" + "@sentry/hub@5.30.0": version "5.30.0" resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.30.0.tgz#2453be9b9cb903404366e198bd30c7ca74cdc100" @@ -1208,6 +1241,25 @@ "@sentry/utils" "5.30.0" tslib "^1.9.3" +"@sentry/hub@6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.5.1.tgz#135ef09d07d32e87a53f664c0ae8fcc4f5963519" + integrity sha512-lBRMBVMYP8B4PfRiM70murbtJAXiIAao/asDEMIRNGMP6pI2ArqXfJCBYDkStukhikYD0Kqb4trXq+JYF07Hbg== + dependencies: + "@sentry/types" "6.5.1" + "@sentry/utils" "6.5.1" + tslib "^1.9.3" + +"@sentry/integrations@6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-6.5.1.tgz#e7016f3023a98e2ef893daba18ba74bd8d62654b" + integrity sha512-NYiW0rH7fwv7aRtrRnfCSIiwulfV2NoLjhmghCONsyo10DNtYmOpogLotCytZFWLDnTJW1+pmTomq8UW/OSTcQ== + dependencies: + "@sentry/types" "6.5.1" + "@sentry/utils" "6.5.1" + localforage "^1.8.1" + tslib "^1.9.3" + "@sentry/integrations@^5.21.3": version "5.30.0" resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-5.30.0.tgz#2f25fb998cb19c76b3803d84c1a577b3d837010f" @@ -1227,6 +1279,44 @@ "@sentry/types" "5.30.0" tslib "^1.9.3" +"@sentry/minimal@6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.5.1.tgz#b8c1b382c2ea788eec3d32d203e5081b00eb6838" + integrity sha512-q9Do/oreu1RP695CXCLowVDuQyk7ilE6FGdz2QLpTXAfx8247qOwk6+zy9Kea/Djk93+BoSDVQUSneNiVwl0nQ== + dependencies: + "@sentry/hub" "6.5.1" + "@sentry/types" "6.5.1" + tslib "^1.9.3" + +"@sentry/nextjs@^6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@sentry/nextjs/-/nextjs-6.5.1.tgz#a16d5b01ec46b853fc540ac081e83458461e9b43" + integrity sha512-cuSGvK8iCA9Nfakj5k903POE4kLSYWLLfjEfaP3CdfXD5KyZL6xhxvFJoZfq8mQT8dDLH4QArTpSIbUtic3meg== + dependencies: + "@sentry/core" "6.5.1" + "@sentry/integrations" "6.5.1" + "@sentry/node" "6.5.1" + "@sentry/react" "6.5.1" + "@sentry/tracing" "6.5.1" + "@sentry/utils" "6.5.1" + "@sentry/webpack-plugin" "1.15.0" + tslib "^1.9.3" + +"@sentry/node@6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.5.1.tgz#a572b380858de5aeaf98eade6d8d3afcba13d364" + integrity sha512-Yh8J/QJ5e8gRBVL9VLCDpUvmiaxsxVZm0CInPHw3V/smgMkrzSKEiqxSeMq8ImPlaJrCFECqdpv4gnvYKI+mQQ== + dependencies: + "@sentry/core" "6.5.1" + "@sentry/hub" "6.5.1" + "@sentry/tracing" "6.5.1" + "@sentry/types" "6.5.1" + "@sentry/utils" "6.5.1" + cookie "^0.4.1" + https-proxy-agent "^5.0.0" + lru_map "^0.3.3" + tslib "^1.9.3" + "@sentry/node@^5.21.3": version "5.30.0" resolved "https://registry.yarnpkg.com/@sentry/node/-/node-5.30.0.tgz#4ca479e799b1021285d7fe12ac0858951c11cd48" @@ -1242,6 +1332,18 @@ lru_map "^0.3.3" tslib "^1.9.3" +"@sentry/react@6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.5.1.tgz#1c7019fc3d8b1168c1ab8936cb65971b314d060d" + integrity sha512-YeGi7FzInhMZQxiy5fKqb7kS6W+u4NfsjzsVV3bLjJ1kiVtbpzZ2gs+ObHqW3zVE622V4nL7A4P8/CBHbcm5PA== + dependencies: + "@sentry/browser" "6.5.1" + "@sentry/minimal" "6.5.1" + "@sentry/types" "6.5.1" + "@sentry/utils" "6.5.1" + hoist-non-react-statics "^3.3.2" + tslib "^1.9.3" + "@sentry/tracing@5.30.0": version "5.30.0" resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-5.30.0.tgz#501d21f00c3f3be7f7635d8710da70d9419d4e1f" @@ -1253,15 +1355,33 @@ "@sentry/utils" "5.30.0" tslib "^1.9.3" +"@sentry/tracing@6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.5.1.tgz#a5f3e497d4f1f319f36475df050e135cf65af750" + integrity sha512-y1W/xFC2hAuKqSuuaovkElHY4pbli3XoXrreesg8PtO7ilX6ZbatOQbHsEsHQyoUv0F6aVA+MABOxWH2jt7tfw== + dependencies: + "@sentry/hub" "6.5.1" + "@sentry/minimal" "6.5.1" + "@sentry/types" "6.5.1" + "@sentry/utils" "6.5.1" + tslib "^1.9.3" + "@sentry/types@5.30.0": version "5.30.0" resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.30.0.tgz#19709bbe12a1a0115bc790b8942917da5636f402" integrity sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw== +<<<<<<< HEAD "@sentry/types@^6.6.0": version "6.7.0" resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.7.0.tgz#93f105c3bbca08224db79d9dd83bed0a56ef13d3" integrity sha512-5pKv0yJEOnkjy3J3eiGaM1CD2+p3rXkctJa8loZH7QgY7mJgUTKpozO3YymUmGjblthlrbuhH+5wUIBnVF60Bg== +======= +"@sentry/types@6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.5.1.tgz#0a34ecfd1ae9275a416a105640eb4bed45a46a1d" + integrity sha512-b/7a6CMoytaeFPx4IBjfxPw3nPvsQh7ui1C8Vw0LxNNDgBwVhPLzUOWeLWbo5YZCVbGEMIWwtCUQYWxneceZSA== +>>>>>>> updated to @sentry/nextjs package "@sentry/utils@5.30.0": version "5.30.0" @@ -1271,6 +1391,21 @@ "@sentry/types" "5.30.0" tslib "^1.9.3" +"@sentry/utils@6.5.1": + version "6.5.1" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.5.1.tgz#046baf7d1a6564d6d555437ad3674dba9bc0806a" + integrity sha512-Wv86JYGQH+ZJ5XGFQX7h6ijl32667ikenoL9EyXMn8UoOYX/MLwZoQZin1P60wmKkYR9ifTNVmpaI9OoTaH+UQ== + dependencies: + "@sentry/types" "6.5.1" + tslib "^1.9.3" + +"@sentry/webpack-plugin@1.15.0": + version "1.15.0" + resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-1.15.0.tgz#c7f9eafbbace1929c3fb81bb720fc0d7e8b4f86d" + integrity sha512-KHVug+xI+KH/xCL7otWcRRszw0rt6i/BCH5F8+6/njz2gCBrYQOzdMvzWm4GeXZUuw5ekgycYaUhDs1/6enjuQ== + dependencies: + "@sentry/cli" "^1.63.1" + "@sentry/webpack-plugin@^1.12.1": version "1.15.1" resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-1.15.1.tgz#deb014fce8c1b51811100f25ec9050dd03addd9b" @@ -3515,7 +3650,7 @@ hmac-drbg@^1.0.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1: +hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1, hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== @@ -4084,7 +4219,7 @@ loader-utils@1.2.3: emojis-list "^2.0.0" json5 "^1.0.1" -localforage@*, localforage@^1.9.0: +localforage@*, localforage@^1.8.1, localforage@^1.9.0: version "1.9.0" resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.9.0.tgz#f3e4d32a8300b362b4634cc4e066d9d00d2f09d1" integrity sha512-rR1oyNrKulpe+VM9cYmcFn6tsHuokyVHFaCM3+osEmxaHTbEk8oQu6eGDfS6DQLWi/N67XRmB8ECG37OES368g== From ce64a6eb4fbe84c5cd7c9c57f2a59651ef435c53 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Wed, 9 Jun 2021 18:03:23 +0530 Subject: [PATCH 02/16] added envvironment variable to sentry init --- sentry.client.config.js | 1 + sentry.server.config.js | 1 + 2 files changed, 2 insertions(+) diff --git a/sentry.client.config.js b/sentry.client.config.js index 303334ade..723f6c9e5 100644 --- a/sentry.client.config.js +++ b/sentry.client.config.js @@ -8,6 +8,7 @@ Sentry.init({ // for finer control tracesSampleRate: 1.0, release: 'bada-frame-v' + process.env.npm_package_version, + environment: process.env.NODE_ENV, // ... // Note: if you want to override the automatic release value, do not set a // `release` value here - use the environment variable `SENTRY_RELEASE`, so diff --git a/sentry.server.config.js b/sentry.server.config.js index 04212e1b5..e0ff637c8 100644 --- a/sentry.server.config.js +++ b/sentry.server.config.js @@ -8,6 +8,7 @@ Sentry.init({ // for finer control tracesSampleRate: 1.0, release: 'bada-frame-v' + process.env.npm_package_version, + environment: process.env.NODE_ENV, // ... // Note: if you want to override the automatic release value, do not set a // `release` value here - use the environment variable `SENTRY_RELEASE`, so From 0348bf3fd8168ef8dcde3a483fda17924ecfb69d Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Wed, 9 Jun 2021 20:22:11 +0530 Subject: [PATCH 03/16] attack stack trace --- sentry.client.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/sentry.client.config.js b/sentry.client.config.js index 723f6c9e5..d41b339ea 100644 --- a/sentry.client.config.js +++ b/sentry.client.config.js @@ -9,6 +9,7 @@ Sentry.init({ tracesSampleRate: 1.0, release: 'bada-frame-v' + process.env.npm_package_version, environment: process.env.NODE_ENV, + attachStacktrace: true, // ... // Note: if you want to override the automatic release value, do not set a // `release` value here - use the environment variable `SENTRY_RELEASE`, so From 6833cdc532b2e5aa2c9eba89c1445cc23e36dd94 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Thu, 10 Jun 2021 09:58:29 +0530 Subject: [PATCH 04/16] send npm package version as relases version with sentry --- next.config.js | 5 ++++- package.json | 2 +- sentry.client.config.js | 4 +--- sentry.server.config.js | 8 +------- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/next.config.js b/next.config.js index c81e13fad..b71b8fb29 100644 --- a/next.config.js +++ b/next.config.js @@ -10,8 +10,11 @@ module.exports = withSentryConfig(withWorkbox(withBundleAnalyzer({ future: { webpack5: true, }, + env: { + SENTRY_RELEASE: process.env.npm_package_version, + }, workbox: { swSrc: 'src/serviceWorker.js', exclude: ['/manifest.json'], }, -}))); +})), { release: process.env.npm_package_version }); diff --git a/package.json b/package.json index bfa7859b3..a1589f569 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bada-frame", - "version": "0.1.0", + "version": "0.2.0", "private": true, "scripts": { "dev": "next dev", diff --git a/sentry.client.config.js b/sentry.client.config.js index d41b339ea..b96b9e310 100644 --- a/sentry.client.config.js +++ b/sentry.client.config.js @@ -4,11 +4,9 @@ const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN; Sentry.init({ dsn: SENTRY_DSN, - // We recommend adjusting this value in production, or using tracesSampler - // for finer control tracesSampleRate: 1.0, - release: 'bada-frame-v' + process.env.npm_package_version, environment: process.env.NODE_ENV, + release: process.env.SENTRY_RELEASE, attachStacktrace: true, // ... // Note: if you want to override the automatic release value, do not set a diff --git a/sentry.server.config.js b/sentry.server.config.js index e0ff637c8..fce021a3c 100644 --- a/sentry.server.config.js +++ b/sentry.server.config.js @@ -4,13 +4,7 @@ const SENTRY_DSN = process.env.SENTRY_DSN; Sentry.init({ dsn: SENTRY_DSN, - // We recommend adjusting this value in production, or using tracesSampler - // for finer control tracesSampleRate: 1.0, - release: 'bada-frame-v' + process.env.npm_package_version, environment: process.env.NODE_ENV, - // ... - // Note: if you want to override the automatic release value, do not set a - // `release` value here - use the environment variable `SENTRY_RELEASE`, so - // that it will also get attached to your source maps + release: process.env.SENTRY_RELEASE, }); From 51978eb1644c19f8efe32774a2981da2c18d0771 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Tue, 15 Jun 2021 10:16:10 +0530 Subject: [PATCH 05/16] set fallback value for SENTRY_DSN and SENTRY_ENV --- sentry.client.config.js | 5 +++-- sentry.server.config.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sentry.client.config.js b/sentry.client.config.js index b96b9e310..bd2cf00bd 100644 --- a/sentry.client.config.js +++ b/sentry.client.config.js @@ -1,11 +1,12 @@ import * as Sentry from '@sentry/nextjs'; -const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN; +const SENTRY_DSN = process.env.SENTRY_DSN ?? 'https://860186db60c54c7fbacfe255124958e8@errors.ente.io/4'; +const SENTRY_ENV = process.env.SENTRY_ENV ?? 'development'; Sentry.init({ dsn: SENTRY_DSN, tracesSampleRate: 1.0, - environment: process.env.NODE_ENV, + environment: SENTRY_ENV, release: process.env.SENTRY_RELEASE, attachStacktrace: true, // ... diff --git a/sentry.server.config.js b/sentry.server.config.js index fce021a3c..e889de29f 100644 --- a/sentry.server.config.js +++ b/sentry.server.config.js @@ -1,10 +1,11 @@ import * as Sentry from '@sentry/nextjs'; -const SENTRY_DSN = process.env.SENTRY_DSN; +const SENTRY_DSN = process.env.SENTRY_DSN ?? 'https://860186db60c54c7fbacfe255124958e8@errors.ente.io/4'; +const SENTRY_ENV = process.env.SENTRY_ENV ?? 'development'; Sentry.init({ dsn: SENTRY_DSN, tracesSampleRate: 1.0, - environment: process.env.NODE_ENV, + environment: SENTRY_ENV, release: process.env.SENTRY_RELEASE, }); From 348424f979251e8a1069c15ef9062a10f719a718 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Thu, 10 Jun 2021 09:58:48 +0530 Subject: [PATCH 06/16] testing error button --- src/pages/gallery/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index 79eaf7c6f..b02f4976b 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -348,6 +348,11 @@ export default function Gallery() { getInputProps={getInputProps} showCollectionSelector={setCollectionSelectorView.bind(null, true)} > + {loading && ( From 290be571cf7df7602f9eca6eda0e7d4efddae708 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Tue, 15 Jun 2021 10:43:46 +0530 Subject: [PATCH 07/16] yarn lock update --- yarn.lock | 121 ------------------------------------------------------ 1 file changed, 121 deletions(-) diff --git a/yarn.lock b/yarn.lock index 23aad94f4..2ae91907c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1176,16 +1176,6 @@ "@sentry/utils" "6.5.1" tslib "^1.9.3" -"@sentry/browser@^5.21.3": - version "5.30.0" - resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.30.0.tgz#c28f49d551db3172080caef9f18791a7fd39e3b3" - integrity sha512-rOb58ZNVJWh1VuMuBG1mL9r54nZqKeaIlwSlvzJfc89vyfd7n6tQ1UXMN383QBz/MS5H5z44Hy5eE+7pCrYAfw== - dependencies: - "@sentry/core" "5.30.0" - "@sentry/types" "5.30.0" - "@sentry/utils" "5.30.0" - tslib "^1.9.3" - "@sentry/cli@^1.63.1": version "1.65.0" resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.65.0.tgz#bdf613e3a4359b9e282b968a7387d5dca361931b" @@ -1198,29 +1188,6 @@ progress "^2.0.3" proxy-from-env "^1.1.0" -"@sentry/cli@^1.64.1": - version "1.66.0" - resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.66.0.tgz#0526f1bc1c0570ce72ed817190af92f3b63a2e9a" - integrity sha512-2pZ+JHnvKqwyJWcGkKg/gCM/zURYronAnruBNllI+rH2g5IL0N90deMmjB1xcqXS66J222+MPTtWrGEK1Vl0/w== - dependencies: - https-proxy-agent "^5.0.0" - mkdirp "^0.5.5" - node-fetch "^2.6.0" - npmlog "^4.1.2" - progress "^2.0.3" - proxy-from-env "^1.1.0" - -"@sentry/core@5.30.0": - version "5.30.0" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.30.0.tgz#6b203664f69e75106ee8b5a2fe1d717379b331f3" - integrity sha512-TmfrII8w1PQZSZgPpUESqjB+jC6MvZJZdLtE/0hZ+SrnKhW3x5WlYLvTXZpcWePYBku7rl2wn1RZu6uT0qCTeg== - dependencies: - "@sentry/hub" "5.30.0" - "@sentry/minimal" "5.30.0" - "@sentry/types" "5.30.0" - "@sentry/utils" "5.30.0" - tslib "^1.9.3" - "@sentry/core@6.5.1": version "6.5.1" resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.5.1.tgz#c8b6c3ed86ed07b193c95d599c1b9a4a161e500e" @@ -1232,15 +1199,6 @@ "@sentry/utils" "6.5.1" tslib "^1.9.3" -"@sentry/hub@5.30.0": - version "5.30.0" - resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.30.0.tgz#2453be9b9cb903404366e198bd30c7ca74cdc100" - integrity sha512-2tYrGnzb1gKz2EkMDQcfLrDTvmGcQPuWxLnJKXJvYTQDGLlEvi2tWz1VIHjunmOvJrB5aIQLhm+dcMRwFZDCqQ== - dependencies: - "@sentry/types" "5.30.0" - "@sentry/utils" "5.30.0" - tslib "^1.9.3" - "@sentry/hub@6.5.1": version "6.5.1" resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.5.1.tgz#135ef09d07d32e87a53f664c0ae8fcc4f5963519" @@ -1260,25 +1218,6 @@ localforage "^1.8.1" tslib "^1.9.3" -"@sentry/integrations@^5.21.3": - version "5.30.0" - resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-5.30.0.tgz#2f25fb998cb19c76b3803d84c1a577b3d837010f" - integrity sha512-Fqh4ALLoQWdd+1ih0iBduANWFyNmFWMxwvBu3V/wLDRi8OcquI0lEzWai1InzTJTiNhRHPnhuU++l/vkO0OCww== - dependencies: - "@sentry/types" "5.30.0" - "@sentry/utils" "5.30.0" - localforage "1.8.1" - tslib "^1.9.3" - -"@sentry/minimal@5.30.0": - version "5.30.0" - resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.30.0.tgz#ce3d3a6a273428e0084adcb800bc12e72d34637b" - integrity sha512-BwWb/owZKtkDX+Sc4zCSTNcvZUq7YcH3uAVlmh/gtR9rmUvbzAA3ewLuB3myi4wWRAMEtny6+J/FN/x+2wn9Xw== - dependencies: - "@sentry/hub" "5.30.0" - "@sentry/types" "5.30.0" - tslib "^1.9.3" - "@sentry/minimal@6.5.1": version "6.5.1" resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.5.1.tgz#b8c1b382c2ea788eec3d32d203e5081b00eb6838" @@ -1317,21 +1256,6 @@ lru_map "^0.3.3" tslib "^1.9.3" -"@sentry/node@^5.21.3": - version "5.30.0" - resolved "https://registry.yarnpkg.com/@sentry/node/-/node-5.30.0.tgz#4ca479e799b1021285d7fe12ac0858951c11cd48" - integrity sha512-Br5oyVBF0fZo6ZS9bxbJZG4ApAjRqAnqFFurMVJJdunNb80brh7a5Qva2kjhm+U6r9NJAB5OmDyPkA1Qnt+QVg== - dependencies: - "@sentry/core" "5.30.0" - "@sentry/hub" "5.30.0" - "@sentry/tracing" "5.30.0" - "@sentry/types" "5.30.0" - "@sentry/utils" "5.30.0" - cookie "^0.4.1" - https-proxy-agent "^5.0.0" - lru_map "^0.3.3" - tslib "^1.9.3" - "@sentry/react@6.5.1": version "6.5.1" resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.5.1.tgz#1c7019fc3d8b1168c1ab8936cb65971b314d060d" @@ -1344,17 +1268,6 @@ hoist-non-react-statics "^3.3.2" tslib "^1.9.3" -"@sentry/tracing@5.30.0": - version "5.30.0" - resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-5.30.0.tgz#501d21f00c3f3be7f7635d8710da70d9419d4e1f" - integrity sha512-dUFowCr0AIMwiLD7Fs314Mdzcug+gBVo/+NCMyDw8tFxJkwWAKl7Qa2OZxLQ0ZHjakcj1hNKfCQJ9rhyfOl4Aw== - dependencies: - "@sentry/hub" "5.30.0" - "@sentry/minimal" "5.30.0" - "@sentry/types" "5.30.0" - "@sentry/utils" "5.30.0" - tslib "^1.9.3" - "@sentry/tracing@6.5.1": version "6.5.1" resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.5.1.tgz#a5f3e497d4f1f319f36475df050e135cf65af750" @@ -1366,30 +1279,10 @@ "@sentry/utils" "6.5.1" tslib "^1.9.3" -"@sentry/types@5.30.0": - version "5.30.0" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.30.0.tgz#19709bbe12a1a0115bc790b8942917da5636f402" - integrity sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw== - -<<<<<<< HEAD -"@sentry/types@^6.6.0": - version "6.7.0" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.7.0.tgz#93f105c3bbca08224db79d9dd83bed0a56ef13d3" - integrity sha512-5pKv0yJEOnkjy3J3eiGaM1CD2+p3rXkctJa8loZH7QgY7mJgUTKpozO3YymUmGjblthlrbuhH+5wUIBnVF60Bg== -======= "@sentry/types@6.5.1": version "6.5.1" resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.5.1.tgz#0a34ecfd1ae9275a416a105640eb4bed45a46a1d" integrity sha512-b/7a6CMoytaeFPx4IBjfxPw3nPvsQh7ui1C8Vw0LxNNDgBwVhPLzUOWeLWbo5YZCVbGEMIWwtCUQYWxneceZSA== ->>>>>>> updated to @sentry/nextjs package - -"@sentry/utils@5.30.0": - version "5.30.0" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.30.0.tgz#9a5bd7ccff85ccfe7856d493bffa64cabc41e980" - integrity sha512-zaYmoH0NWWtvnJjC9/CBseXMtKHm/tm40sz3YfJRxeQjyzRqNQPgivpd9R/oDJCYj999mzdW382p/qi2ypjLww== - dependencies: - "@sentry/types" "5.30.0" - tslib "^1.9.3" "@sentry/utils@6.5.1": version "6.5.1" @@ -1406,13 +1299,6 @@ dependencies: "@sentry/cli" "^1.63.1" -"@sentry/webpack-plugin@^1.12.1": - version "1.15.1" - resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-1.15.1.tgz#deb014fce8c1b51811100f25ec9050dd03addd9b" - integrity sha512-/Z06MJDXyWcN2+CbeDTMDwVzySjgZWQajOke773TvpkgqdtkeT1eYBsA+pfsje+ZE1prEgrZdlH/L9HdM1odnQ== - dependencies: - "@sentry/cli" "^1.64.1" - "@stripe/stripe-js@^1.13.2": version "1.15.0" resolved "https://registry.yarnpkg.com/@stripe/stripe-js/-/stripe-js-1.15.0.tgz#86178cfbe66151910b09b03595e60048ab4c698e" @@ -4226,13 +4112,6 @@ localforage@*, localforage@^1.8.1, localforage@^1.9.0: dependencies: lie "3.1.1" -localforage@1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.8.1.tgz#f6c0a24b41ab33b10e4dc84342dd696f6f3e3433" - integrity sha512-azSSJJfc7h4bVpi0PGi+SmLQKJl2/8NErI+LhJsrORNikMZnhaQ7rv9fHj+ofwgSHrKRlsDCL/639a6nECIKuQ== - dependencies: - lie "3.1.1" - locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" From 0900d0439e2a761e777e3d556f155688254ddc83 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Tue, 15 Jun 2021 11:27:10 +0530 Subject: [PATCH 08/16] disable sentry tracing and sessionTracking --- sentry.client.config.js | 3 ++- sentry.server.config.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sentry.client.config.js b/sentry.client.config.js index bd2cf00bd..ee133e307 100644 --- a/sentry.client.config.js +++ b/sentry.client.config.js @@ -5,10 +5,11 @@ const SENTRY_ENV = process.env.SENTRY_ENV ?? 'development'; Sentry.init({ dsn: SENTRY_DSN, - tracesSampleRate: 1.0, environment: SENTRY_ENV, release: process.env.SENTRY_RELEASE, attachStacktrace: true, + debug: true, + autoSessionTracking: false, // ... // Note: if you want to override the automatic release value, do not set a // `release` value here - use the environment variable `SENTRY_RELEASE`, so diff --git a/sentry.server.config.js b/sentry.server.config.js index e889de29f..26669ed5c 100644 --- a/sentry.server.config.js +++ b/sentry.server.config.js @@ -5,7 +5,8 @@ const SENTRY_ENV = process.env.SENTRY_ENV ?? 'development'; Sentry.init({ dsn: SENTRY_DSN, - tracesSampleRate: 1.0, environment: SENTRY_ENV, release: process.env.SENTRY_RELEASE, + debug: true, + autoSessionTracking: false, }); From c2dfdf221cf606e152bce7ad1116ca246d2fc983 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Tue, 15 Jun 2021 11:27:22 +0530 Subject: [PATCH 09/16] renamed test error --- src/pages/gallery/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index b02f4976b..b45b75c0b 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -349,7 +349,7 @@ export default function Gallery() { showCollectionSelector={setCollectionSelectorView.bind(null, true)} > From 526a6b8891391c176a8136cf92b501e38b99af33 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Tue, 15 Jun 2021 14:37:32 +0530 Subject: [PATCH 10/16] set release version with gitsha --- next.config.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/next.config.js b/next.config.js index b71b8fb29..bab80edcc 100644 --- a/next.config.js +++ b/next.config.js @@ -5,16 +5,21 @@ const withWorkbox = require('next-with-workbox'); const { withSentryConfig } = require('@sentry/nextjs'); +const cp = require('child_process'); +const gitSha = cp.execSync('git rev-parse --short HEAD', { + cwd: __dirname, + encoding: 'utf8', +}); module.exports = withSentryConfig(withWorkbox(withBundleAnalyzer({ future: { webpack5: true, }, env: { - SENTRY_RELEASE: process.env.npm_package_version, + SENTRY_RELEASE: gitSha, }, workbox: { swSrc: 'src/serviceWorker.js', exclude: ['/manifest.json'], }, -})), { release: process.env.npm_package_version }); +})), { release: gitSha }); From 1c8e480f0bd4bd0d4ebc0b51490cc1de1c925392 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Wed, 16 Jun 2021 12:00:49 +0530 Subject: [PATCH 11/16] remove testing button --- src/pages/gallery/index.tsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index b45b75c0b..79eaf7c6f 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -348,11 +348,6 @@ export default function Gallery() { getInputProps={getInputProps} showCollectionSelector={setCollectionSelectorView.bind(null, true)} > - {loading && ( From df6988ee704410653937163698e05eb63e145dc8 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Wed, 16 Jun 2021 12:02:43 +0530 Subject: [PATCH 12/16] changed back package json version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2c07670ed..78962a4bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bada-frame", - "version": "0.2.0", + "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", From 3410ca0aed1f76e0705e543f1c04521e546728fc Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Wed, 16 Jun 2021 12:06:09 +0530 Subject: [PATCH 13/16] send sentry error on non-delopment environment --- sentry.client.config.js | 2 +- sentry.server.config.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sentry.client.config.js b/sentry.client.config.js index ee133e307..83df37f30 100644 --- a/sentry.client.config.js +++ b/sentry.client.config.js @@ -5,7 +5,7 @@ const SENTRY_ENV = process.env.SENTRY_ENV ?? 'development'; Sentry.init({ dsn: SENTRY_DSN, - environment: SENTRY_ENV, + enabled: SENTRY_ENV !== 'development', release: process.env.SENTRY_RELEASE, attachStacktrace: true, debug: true, diff --git a/sentry.server.config.js b/sentry.server.config.js index 26669ed5c..87445aa41 100644 --- a/sentry.server.config.js +++ b/sentry.server.config.js @@ -5,6 +5,7 @@ const SENTRY_ENV = process.env.SENTRY_ENV ?? 'development'; Sentry.init({ dsn: SENTRY_DSN, + enabled: SENTRY_ENV !== 'development', environment: SENTRY_ENV, release: process.env.SENTRY_RELEASE, debug: true, From c3fdcea63178193f01309e26c77ed2a9e8b5d406 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Wed, 16 Jun 2021 12:18:10 +0530 Subject: [PATCH 14/16] checking sentryenv value --- sentry.client.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry.client.config.js b/sentry.client.config.js index 83df37f30..fcd3ca146 100644 --- a/sentry.client.config.js +++ b/sentry.client.config.js @@ -2,7 +2,7 @@ import * as Sentry from '@sentry/nextjs'; const SENTRY_DSN = process.env.SENTRY_DSN ?? 'https://860186db60c54c7fbacfe255124958e8@errors.ente.io/4'; const SENTRY_ENV = process.env.SENTRY_ENV ?? 'development'; - +console.log(SENTRY_ENV); Sentry.init({ dsn: SENTRY_DSN, enabled: SENTRY_ENV !== 'development', From 87846524b6a3dd872f934f4fd192d86a917f697d Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Wed, 16 Jun 2021 13:10:42 +0530 Subject: [PATCH 15/16] correct env variables --- sentry.client.config.js | 4 ++-- sentry.server.config.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sentry.client.config.js b/sentry.client.config.js index fcd3ca146..9149ab737 100644 --- a/sentry.client.config.js +++ b/sentry.client.config.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/nextjs'; -const SENTRY_DSN = process.env.SENTRY_DSN ?? 'https://860186db60c54c7fbacfe255124958e8@errors.ente.io/4'; -const SENTRY_ENV = process.env.SENTRY_ENV ?? 'development'; +const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN ?? 'https://860186db60c54c7fbacfe255124958e8@errors.ente.io/4'; +const SENTRY_ENV = process.env.NEXT_PUBLIC_SENTRY_ENV ?? 'development'; console.log(SENTRY_ENV); Sentry.init({ dsn: SENTRY_DSN, diff --git a/sentry.server.config.js b/sentry.server.config.js index 87445aa41..01a7609e2 100644 --- a/sentry.server.config.js +++ b/sentry.server.config.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/nextjs'; -const SENTRY_DSN = process.env.SENTRY_DSN ?? 'https://860186db60c54c7fbacfe255124958e8@errors.ente.io/4'; -const SENTRY_ENV = process.env.SENTRY_ENV ?? 'development'; +const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN ?? 'https://860186db60c54c7fbacfe255124958e8@errors.ente.io/4'; +const SENTRY_ENV = process.env.NEXT_PUBLIC_SENTRY_ENV ?? 'development'; Sentry.init({ dsn: SENTRY_DSN, From 472933fffa7318f40bc8a57969b7b8a273856868 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Wed, 16 Jun 2021 13:57:40 +0530 Subject: [PATCH 16/16] remove debug prop from sentry --- sentry.client.config.js | 2 -- sentry.server.config.js | 1 - 2 files changed, 3 deletions(-) diff --git a/sentry.client.config.js b/sentry.client.config.js index 9149ab737..6b1e89086 100644 --- a/sentry.client.config.js +++ b/sentry.client.config.js @@ -2,13 +2,11 @@ import * as Sentry from '@sentry/nextjs'; const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN ?? 'https://860186db60c54c7fbacfe255124958e8@errors.ente.io/4'; const SENTRY_ENV = process.env.NEXT_PUBLIC_SENTRY_ENV ?? 'development'; -console.log(SENTRY_ENV); Sentry.init({ dsn: SENTRY_DSN, enabled: SENTRY_ENV !== 'development', release: process.env.SENTRY_RELEASE, attachStacktrace: true, - debug: true, autoSessionTracking: false, // ... // Note: if you want to override the automatic release value, do not set a diff --git a/sentry.server.config.js b/sentry.server.config.js index 01a7609e2..33af4278b 100644 --- a/sentry.server.config.js +++ b/sentry.server.config.js @@ -8,6 +8,5 @@ Sentry.init({ enabled: SENTRY_ENV !== 'development', environment: SENTRY_ENV, release: process.env.SENTRY_RELEASE, - debug: true, autoSessionTracking: false, });