Browse Source

send npm package version as relases version with sentry

Abhinav-grd 4 years ago
parent
commit
6833cdc532
4 changed files with 7 additions and 12 deletions
  1. 4 1
      next.config.js
  2. 1 1
      package.json
  3. 1 3
      sentry.client.config.js
  4. 1 7
      sentry.server.config.js

+ 4 - 1
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 });

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "bada-frame",
-  "version": "0.1.0",
+  "version": "0.2.0",
   "private": true,
   "scripts": {
     "dev": "next dev",

+ 1 - 3
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

+ 1 - 7
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,
 });