From 4b1ce539d58438c32984a9c73fbdedd661d25890 Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Thu, 24 Nov 2022 16:58:36 +0100 Subject: [PATCH] remove sentry integration --- .env.example | 4 ---- .github/workflows/digitalocean-deploy.yml | 1 + .github/workflows/docker-build-push.yml | 10 ---------- client/.gitignore | 3 --- client/next.config.js | 14 +------------- client/package.json | 1 - client/pages/_error.tsx | 16 ---------------- client/sentry.client.config.js | 11 ----------- client/sentry.properties | 3 --- client/sentry.server.config.js | 11 ----------- server/package.json | 1 - server/sentry.properties | 3 --- server/src/app.module.ts | 5 ----- server/src/config/config.module.ts | 15 +-------------- server/src/config/logging.config.ts | 5 ----- server/src/interceptors/sentry.interceptor.ts | 15 --------------- server/src/main.ts | 4 ---- 17 files changed, 3 insertions(+), 119 deletions(-) delete mode 100644 client/pages/_error.tsx delete mode 100644 client/sentry.client.config.js delete mode 100644 client/sentry.properties delete mode 100644 client/sentry.server.config.js delete mode 100644 server/sentry.properties delete mode 100644 server/src/config/logging.config.ts delete mode 100644 server/src/interceptors/sentry.interceptor.ts diff --git a/.env.example b/.env.example index 56ceda1db..e300445c5 100644 --- a/.env.example +++ b/.env.example @@ -2,10 +2,6 @@ TURBO_TEAM= TURBO_TOKEN= -# Error Logging -SERVER_SENTRY_DSN= -PUBLIC_CLIENT_SENTRY_DSN= - # Server + Client TZ=UTC PUBLIC_URL=http://localhost:3000 diff --git a/.github/workflows/digitalocean-deploy.yml b/.github/workflows/digitalocean-deploy.yml index 8760a3ee6..7b9cf70f4 100644 --- a/.github/workflows/digitalocean-deploy.yml +++ b/.github/workflows/digitalocean-deploy.yml @@ -1,6 +1,7 @@ name: Deploy Latest Version on DigitalOcean on: + workflow_dispatch: workflow_run: workflows: - Build and Push Docker Image diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index 7026ebd9d..f920ea3d5 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -51,21 +51,11 @@ jobs: - name: Build and Push Docker Image uses: docker/build-push-action@v3.2.0 - env: - SENTRY_ORG: reactive-resume - SENTRY_URL: https://sentry.io - SENTRY_PROJECT: ${{ matrix.image }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} with: context: . push: true platforms: ${{ matrix.arch }} file: ${{ matrix.image }}/Dockerfile - build-args: | - SENTRY_ORG=reactive-resume - SENTRY_URL=https://sentry.io - SENTRY_PROJECT=${{ matrix.image }} - SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} tags: | amruthpillai/reactive-resume:${{ matrix.image }}-latest amruthpillai/reactive-resume:${{ matrix.image }}-${{ steps.version.outputs.current-version }} diff --git a/client/.gitignore b/client/.gitignore index f061b93e2..6cf4f584e 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -40,6 +40,3 @@ __ENV.js # next-sitemap sitemap*.xml - -# Sentry -.sentryclirc diff --git a/client/next.config.js b/client/next.config.js index 85e766b5b..33494d513 100644 --- a/client/next.config.js +++ b/client/next.config.js @@ -1,6 +1,5 @@ const { version } = require('../package.json'); const { i18n } = require('./next-i18next.config'); -const { withSentryConfig } = require('@sentry/nextjs'); /** @type {import('next').NextConfig} */ const nextConfig = { @@ -16,10 +15,6 @@ const nextConfig = { domains: ['cdn.rxresu.me', 'www.gravatar.com'], }, - sentry: { - hideSourceMaps: true, - }, - // Hack to make Tailwind darkMode 'class' strategy with CSS Modules // Ref: https://github.com/tailwindlabs/tailwindcss/issues/3258#issuecomment-968368156 webpack: (config) => { @@ -52,11 +47,4 @@ const nextConfig = { }, }; -/** @type {import('@sentry/nextjs').SentryWebpackPluginOptions} */ -const sentryConfig = { - silent: true, - authToken: process.env.SENTRY_AUTH_TOKEN, - dryRun: process.env.NODE_ENV !== 'production', -}; - -module.exports = withSentryConfig(nextConfig, sentryConfig); +module.exports = nextConfig; diff --git a/client/package.json b/client/package.json index f77a0f2d2..5ab77fe60 100644 --- a/client/package.json +++ b/client/package.json @@ -24,7 +24,6 @@ "@next/env": "^13.0.5", "@react-oauth/google": "^0.5.0", "@reduxjs/toolkit": "^1.9.0", - "@sentry/nextjs": "^7.21.1", "axios": "^1.2.0", "clsx": "^1.2.1", "dayjs": "^1.11.6", diff --git a/client/pages/_error.tsx b/client/pages/_error.tsx deleted file mode 100644 index a687f4321..000000000 --- a/client/pages/_error.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Sentry from '@sentry/nextjs'; -import type { NextPage } from 'next'; -import type { ErrorProps } from 'next/error'; -import NextErrorComponent from 'next/error'; - -const CustomErrorComponent: NextPage = (props) => { - return ; -}; - -CustomErrorComponent.getInitialProps = async (contextData) => { - await Sentry.captureUnderscoreErrorException(contextData); - - return NextErrorComponent.getInitialProps(contextData); -}; - -export default CustomErrorComponent; diff --git a/client/sentry.client.config.js b/client/sentry.client.config.js deleted file mode 100644 index 43526155e..000000000 --- a/client/sentry.client.config.js +++ /dev/null @@ -1,11 +0,0 @@ -import env from '@beam-australia/react-env'; -import * as Sentry from '@sentry/nextjs'; - -const sentryDSN = - env('CLIENT_SENTRY_DSN') || - 'https://aceffdbdaa544768bc85216e7c6a9c50@o4504211187564544.ingest.sentry.io/4504213380071424'; - -Sentry.init({ - dsn: sentryDSN, - tracesSampleRate: 1.0, -}); diff --git a/client/sentry.properties b/client/sentry.properties deleted file mode 100644 index cf9e3b7d2..000000000 --- a/client/sentry.properties +++ /dev/null @@ -1,3 +0,0 @@ -defaults.project=client -defaults.org=reactive-resume -defaults.url=https://sentry.io/ diff --git a/client/sentry.server.config.js b/client/sentry.server.config.js deleted file mode 100644 index 43526155e..000000000 --- a/client/sentry.server.config.js +++ /dev/null @@ -1,11 +0,0 @@ -import env from '@beam-australia/react-env'; -import * as Sentry from '@sentry/nextjs'; - -const sentryDSN = - env('CLIENT_SENTRY_DSN') || - 'https://aceffdbdaa544768bc85216e7c6a9c50@o4504211187564544.ingest.sentry.io/4504213380071424'; - -Sentry.init({ - dsn: sentryDSN, - tracesSampleRate: 1.0, -}); diff --git a/server/package.json b/server/package.json index d91356b2b..a6b5db7fd 100644 --- a/server/package.json +++ b/server/package.json @@ -21,7 +21,6 @@ "@nestjs/serve-static": "^3.0.0", "@nestjs/terminus": "^9.1.3", "@nestjs/typeorm": "^9.0.1", - "@sentry/node": "^7.21.1", "@types/passport": "^1.0.11", "bcryptjs": "^2.4.3", "cache-manager": "^5.1.3", diff --git a/server/sentry.properties b/server/sentry.properties deleted file mode 100644 index 9c1aaad18..000000000 --- a/server/sentry.properties +++ /dev/null @@ -1,3 +0,0 @@ -defaults.project=server -defaults.org=reactive-resume -defaults.url=https://sentry.io/ diff --git a/server/src/app.module.ts b/server/src/app.module.ts index aba158556..2382aafbe 100644 --- a/server/src/app.module.ts +++ b/server/src/app.module.ts @@ -11,7 +11,6 @@ import { HttpExceptionFilter } from './filters/http-exception.filter'; import { FontsModule } from './fonts/fonts.module'; import { HealthModule } from './health/health.module'; import { IntegrationsModule } from './integrations/integrations.module'; -import { SentryInterceptor } from './interceptors/sentry.interceptor'; import { MailModule } from './mail/mail.module'; import { PrinterModule } from './printer/printer.module'; import { ResumeModule } from './resume/resume.module'; @@ -41,10 +40,6 @@ import { UsersModule } from './users/users.module'; provide: APP_INTERCEPTOR, useClass: ClassSerializerInterceptor, }, - { - provide: APP_INTERCEPTOR, - useClass: SentryInterceptor, - }, { provide: APP_FILTER, useClass: HttpExceptionFilter, diff --git a/server/src/config/config.module.ts b/server/src/config/config.module.ts index a032d496c..4f335191e 100644 --- a/server/src/config/config.module.ts +++ b/server/src/config/config.module.ts @@ -7,7 +7,6 @@ import authConfig from './auth.config'; import cacheConfig from './cache.config'; import databaseConfig from './database.config'; import googleConfig from './google.config'; -import loggingConfig from './logging.config'; import mailConfig from './mail.config'; import storageConfig from './storage.config'; @@ -59,24 +58,12 @@ const validationSchema = Joi.object({ PDF_DELETION_TIME: Joi.number() .default(4 * 24 * 60 * 60 * 1000) // 4 days .allow(''), - - // Logging - SERVER_SENTRY_DSN: Joi.string().allow(''), }); @Module({ imports: [ NestConfigModule.forRoot({ - load: [ - appConfig, - authConfig, - cacheConfig, - databaseConfig, - googleConfig, - mailConfig, - storageConfig, - loggingConfig, - ], + load: [appConfig, authConfig, cacheConfig, databaseConfig, googleConfig, mailConfig, storageConfig], validationSchema: validationSchema, }), ], diff --git a/server/src/config/logging.config.ts b/server/src/config/logging.config.ts deleted file mode 100644 index 565230569..000000000 --- a/server/src/config/logging.config.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { registerAs } from '@nestjs/config'; - -export default registerAs('logging', () => ({ - sentryDSN: process.env.SERVER_SENTRY_DSN, -})); diff --git a/server/src/interceptors/sentry.interceptor.ts b/server/src/interceptors/sentry.interceptor.ts deleted file mode 100644 index 7b24812ff..000000000 --- a/server/src/interceptors/sentry.interceptor.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common'; -import * as Sentry from '@sentry/node'; -import { Observable } from 'rxjs'; -import { tap } from 'rxjs/operators'; - -@Injectable() -export class SentryInterceptor implements NestInterceptor { - intercept(_context: ExecutionContext, next: CallHandler): Observable { - return next.handle().pipe( - tap(null, (exception) => { - Sentry.captureException(exception); - }) - ); - } -} diff --git a/server/src/main.ts b/server/src/main.ts index f20792553..7b91488cb 100644 --- a/server/src/main.ts +++ b/server/src/main.ts @@ -2,7 +2,6 @@ import { Logger, ValidationPipe } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { NestFactory } from '@nestjs/core'; import { NestExpressApplication } from '@nestjs/platform-express'; -import * as Sentry from '@sentry/node'; import cookieParser from 'cookie-parser'; import { AppModule } from './app.module'; @@ -19,9 +18,6 @@ const bootstrap = async () => { // Pipes app.useGlobalPipes(new ValidationPipe({ transform: true })); - // Error Logging - Sentry.init({ dsn: configService.get('logging.sentryDSN') }); - // Server Port const port = configService.get('app.port'); await app.listen(port);