diff --git a/web/.env.example b/web/.env.example index acd853834f..9918da07b7 100644 --- a/web/.env.example +++ b/web/.env.example @@ -9,4 +9,9 @@ NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api # The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from # console or api domain. # example: http://udify.app/api -NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api \ No newline at end of file +NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api + +# SENTRY +NEXT_PUBLIC_SENTRY_DSN= +NEXT_PUBLIC_SENTRY_ORG= +NEXT_PUBLIC_SENTRY_PROJECT= \ No newline at end of file diff --git a/web/next.config.js b/web/next.config.js index bb1b73f05f..682e99353f 100644 --- a/web/next.config.js +++ b/web/next.config.js @@ -1,9 +1,10 @@ const { withSentryConfig } = require('@sentry/nextjs') -const EDITION = process.env.NEXT_PUBLIC_EDITION -const IS_CE_EDITION = EDITION === 'SELF_HOSTED' const isDevelopment = process.env.NODE_ENV === 'development' -const isHideSentry = isDevelopment || IS_CE_EDITION +const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN +const SENTRY_ORG = process.env.NEXT_PUBLIC_SENTRY_ORG +const SENTRY_PROJECT = process.env.NEXT_PUBLIC_SENTRY_PROJECT +const isHideSentry = isDevelopment || !SENTRY_DSN || !SENTRY_ORG || !SENTRY_PROJECT const withMDX = require('@next/mdx')({ extension: /\.mdx?$/, @@ -56,8 +57,8 @@ const nextConfig = { // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup const sentryWebpackPluginOptions = { - org: 'perfectworld', - project: 'javascript-nextjs', + org: SENTRY_ORG, + project: SENTRY_PROJECT, silent: true, // Suppresses all logs sourcemaps: { assets: './**', diff --git a/web/package.json b/web/package.json index 07c13a84ca..053c8d901a 100644 --- a/web/package.json +++ b/web/package.json @@ -12,6 +12,7 @@ "prepare": "cd ../ && husky install ./web/.husky" }, "dependencies": { + "@babel/runtime": "^7.22.3", "@emoji-mart/data": "^1.1.2", "@formatjs/intl-localematcher": "^0.2.32", "@headlessui/react": "^1.7.13", @@ -20,6 +21,7 @@ "@mdx-js/react": "^2.3.0", "@next/mdx": "^13.2.4", "@sentry/nextjs": "^7.53.1", + "@sentry/utils": "^7.54.0", "@tailwindcss/line-clamp": "^0.4.2", "@types/crypto-js": "^4.1.1", "@types/lodash-es": "^4.17.7", diff --git a/web/sentry.client.config.js b/web/sentry.client.config.js index 257704bc09..f1a8a9d18d 100644 --- a/web/sentry.client.config.js +++ b/web/sentry.client.config.js @@ -1,14 +1,14 @@ import * as Sentry from '@sentry/nextjs' Sentry.init({ - dsn: 'https://6bf48a450f054d749398c02a61bae343@o4505264807215104.ingest.sentry.io/4505264809115648', + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, // Replay may only be enabled for the client-side integrations: [new Sentry.Replay()], // Set tracesSampleRate to 1.0 to capture 100% // of transactions for performance monitoring. // We recommend adjusting this value in production - tracesSampleRate: 1.0, + tracesSampleRate: 0.1, // Capture Replay for 10% of all sessions, // plus for 100% of sessions with an error diff --git a/web/sentry.edge.config.js b/web/sentry.edge.config.js index 166610cd4f..8e26d68d5d 100644 --- a/web/sentry.edge.config.js +++ b/web/sentry.edge.config.js @@ -1,12 +1,12 @@ import * as Sentry from '@sentry/nextjs' Sentry.init({ - dsn: 'https://6bf48a450f054d749398c02a61bae343@o4505264807215104.ingest.sentry.io/4505264809115648', + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, // Set tracesSampleRate to 1.0 to capture 100% // of transactions for performance monitoring. // We recommend adjusting this value in production - tracesSampleRate: 1.0, + tracesSampleRate: 0.1, // ... diff --git a/web/sentry.server.config.js b/web/sentry.server.config.js index f82445b07e..c67d89128c 100644 --- a/web/sentry.server.config.js +++ b/web/sentry.server.config.js @@ -1,10 +1,10 @@ import * as Sentry from '@sentry/nextjs' Sentry.init({ - dsn: 'https://6bf48a450f054d749398c02a61bae343@o4505264807215104.ingest.sentry.io/4505264809115648', + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, // Set tracesSampleRate to 1.0 to capture 100% // of transactions for performance monitoring. // We recommend adjusting this value in production - tracesSampleRate: 1.0, + tracesSampleRate: 0.1, })