Skip to content

Commit

Permalink
Update packages sentry (#1771)
Browse files Browse the repository at this point in the history
* chore: Update @sentry/nextjs-7.71.0 to 7.80.0

* add sentry package

* update sentry config

* update debug value in sentry web

* feat: add sentry config and update webpack build

* update environment variables

* Minimize comments

* Update .env

* Update .env.sample

* Update .gitignore

* Delete apps/web/pages/sentry-example-page/index.jsx

* Delete apps/web/pages/api/sentry-example-api/index.ts

* Update next.config.js

* Update sentry.client.config.ts

* Update sentry.edge.config.ts

* Update sentry.client.config.ts

* Update sentry.server.config.ts

* Update next.config.js

* Update next.config.js

* Update sentry.client.config.ts

* Update sentry.edge.config.ts

* Update .env

* Update .env.sample

* fix: DNS -> DSN

---------

Co-authored-by: Ruslan K <[email protected]>
  • Loading branch information
NdekoCode and evereq authored Nov 14, 2023
1 parent 05a558e commit 884af94
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 156 deletions.
9 changes: 6 additions & 3 deletions apps/web/.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false

NEXT_PUBLIC_GAUZY_API_SERVER_URL=https://api.gauzy.co
GAUZY_API_SERVER_URL=https://api.gauzy.co/api
NEXT_PUBLIC_GA_MEASUREMENT_ID=SOME_MEASUREMENT_ID
NEXT_PUBLIC_GA_MEASUREMENT_ID=

# CAPTCHA Settings
NEXT_PUBLIC_CAPTCHA_SITE_KEY=
Expand All @@ -22,7 +22,7 @@ SMTP_SECURE=
SMTP_USERNAME=
SMTP_PASSWORD=

# Disable auto api refresh
# Disable auto API refresh
NEXT_PUBLIC_DISABLE_AUTO_REFRESH=false

# App Defaults
Expand All @@ -47,7 +47,10 @@ MEET_JWT_APP_SECRET=
# SENTRY
SENTRY_ORG=ever-co
SENTRY_PROJECT=ever-teams-web
NEXT_PUBLIC_SENTRY_DNS=
SENTRY_LOG_LEVEL=info # info | debug
SENTRY_AUTH_TOKEN=
SENTRY_DSN=
NEXT_PUBLIC_SENTRY_DSN=
NEXT_PUBLIC_SENTRY_DEBUG=false # true/false

# JITSU
Expand Down
9 changes: 6 additions & 3 deletions apps/web/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ APP_LOGO_URL='https://app.ever.team/assets/ever-teams.png'
NEXT_PUBLIC_COOKIE_DOMAINS=ever.team

# SENTRY
SENTRY_ORG=
SENTRY_PROJECT=
NEXT_PUBLIC_SENTRY_DNS=
SENTRY_ORG=ever-co
SENTRY_PROJECT=ever-teams-web
SENTRY_LOG_LEVEL=info # info|debug
SENTRY_AUTH_TOKEN=
SENTRY_DSN=
NEXT_PUBLIC_SENTRY_DSN=
NEXT_PUBLIC_SENTRY_DEBUG=false # true/false

# Jitsu
Expand Down
2 changes: 1 addition & 1 deletion apps/web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

# Sentry Auth Token
# Sentry Config File with Auth Token
.sentryclirc
64 changes: 33 additions & 31 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');

// eslint-disable-next-line @typescript-eslint/no-var-requires
Expand All @@ -20,49 +21,50 @@ const nextConfig = {
'res.cloudinary.com',
'localhost',
'127.0.0.1',
'cdn-icons-png.flaticon.com', // Remove this domain once Backend Icons list are added
'cdn-icons-png.flaticon.com', // Remove this domain once the Backend Icons list is added

Check warning on line 24 in apps/web/next.config.js

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (flaticon)
'api.gauzy.co',
'apistage.gauzy.co',

Check warning on line 26 in apps/web/next.config.js

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (apistage)
'gauzy.s3.wasabisys.com'

Check warning on line 27 in apps/web/next.config.js

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (wasabisys)
]
}
};

// module.exports = nextConfig;

// Injected content via Sentry wizard below

// eslint-disable-next-line @typescript-eslint/no-var-requires
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: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT
},
{
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/

}, // Optional build-time configuration options
sentry: {
// 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)

Check warning on line 36 in apps/web/next.config.js

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (Transpiles)
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
}
);
};

// Injected content via Sentry wizard below
const { withSentryConfig } = require('@sentry/nextjs');

Check warning on line 51 in apps/web/next.config.js

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (nextjs)

const sentryWebpackPluginOptions = {
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,

// An auth token is required for uploading source maps.
authToken: process.env.SENTRY_AUTH_TOKEN,

silent: true, // Suppresses all logs

dryRun: process.env.NODE_ENV !== "production"

// Additional config options for the Sentry Webpack plugin.
// Keep in mind that https://github.com/getsentry/sentry-webpack-plugin#options.
};

// Make sure adding Sentry options is the last code to run before exporting
module.exports = process.env.NODE_ENV === "production" && process.env.SENTRY_DSN
? withSentryConfig(nextConfig, sentryWebpackPluginOptions) : nextConfig
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.4",
"@sentry/nextjs": "^7.71.0",
"@sentry/nextjs": "^7.80.0",

Check warning on line 34 in apps/web/package.json

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (nextjs)
"@tanstack/react-table": "^8.10.7",
"@types/react-google-recaptcha": "^2.1.5",
"@vercel/analytics": "^0.1.6",
Expand Down
44 changes: 24 additions & 20 deletions apps/web/sentry.client.config.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
// 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.
// The config you add here will be used whenever a user loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from '@sentry/nextjs';

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DNS,
const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
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: process.env.NEXT_PUBLIC_SENTRY_DEBUG && process.env.NEXT_PUBLIC_SENTRY_DEBUG === 'true' ? true : false,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: process.env.NEXT_PUBLIC_SENTRY_DEBUG && process.env.NEXT_PUBLIC_SENTRY_DEBUG === 'true' ? true : false,

replaysOnErrorSampleRate: 1.0,
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,
// 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
})
]
});
// Replay may only be enabled for the client-side
// 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
})
]
});
}
18 changes: 11 additions & 7 deletions apps/web/sentry.edge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@

import * as Sentry from '@sentry/nextjs';

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DNS,
const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
if (SENTRY_DSN) {
Sentry.init({
dsn: SENTRY_DSN,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: process.env.NEXT_PUBLIC_SENTRY_DEBUG && process.env.NEXT_PUBLIC_SENTRY_DEBUG === 'true' ? true : false
});
// 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: process.env.NEXT_PUBLIC_SENTRY_DEBUG && process.env.NEXT_PUBLIC_SENTRY_DEBUG === 'true' ? true : false
});
}
18 changes: 11 additions & 7 deletions apps/web/sentry.server.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

import * as Sentry from '@sentry/nextjs';

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DNS,
const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
if (SENTRY_DSN) {
Sentry.init({
dsn: SENTRY_DSN,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: process.env.NEXT_PUBLIC_SENTRY_DEBUG && process.env.NEXT_PUBLIC_SENTRY_DEBUG === 'true' ? true : false
});
// 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: process.env.NEXT_PUBLIC_SENTRY_DEBUG && process.env.NEXT_PUBLIC_SENTRY_DEBUG === 'true' ? true : false
});
}
2 changes: 1 addition & 1 deletion render.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ services:
value: ever-co
- key: SENTRY_PROJECT
value: ever-teams-web
- key: NEXT_PUBLIC_SENTRY_DNS
- key: NEXT_PUBLIC_SENTRY_DSN
sync: false
- key: NEXT_PUBLIC_SENTRY_DEBUG
value: false
Expand Down
Loading

0 comments on commit 884af94

Please sign in to comment.