feat(sentry): remove sentry integration

This commit is contained in:
Amruth Pillai 2022-12-16 14:34:15 +01:00
parent 9af9a0284e
commit bf41aa9c6c
No known key found for this signature in database
GPG Key ID: AB5C6C5E4C464A20
24 changed files with 1049 additions and 1538 deletions

View File

@ -1,12 +1,3 @@
# Turbo Cache (Optional)
TURBO_TEAM=
TURBO_TOKEN=
# Sentry Error Logging (Optional)
SENTRY_AUTH_TOKEN=
SERVER_SENTRY_DSN=
PUBLIC_CLIENT_SENTRY_DSN=
# Server + Client
TZ=UTC
PUBLIC_URL=http://localhost:3000
@ -41,5 +32,5 @@ STORAGE_ACCESS_KEY=
STORAGE_SECRET_KEY=
PDF_DELETION_TIME=345600000
# Flags (Client)
# Client
PUBLIC_FLAG_DISABLE_SIGNUPS=false

View File

@ -10,11 +10,6 @@ jobs:
name: Build and Push Docker Image
runs-on: ubuntu-latest
env:
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
strategy:
matrix:
image: [client, server]
@ -56,22 +51,8 @@ jobs:
push: true
platforms: linux/amd64
file: ${{ matrix.image }}/Dockerfile
build-args: |
TURBO_TEAM=${{ secrets.TURBO_TEAM }}
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
tags: |
amruthpillai/reactive-resume:${{ matrix.image }}-latest
amruthpillai/reactive-resume:${{ matrix.image }}-${{ steps.version.outputs.current-version }}
ghcr.io/amruthpillai/reactive-resume:${{ matrix.image }}-latest
ghcr.io/amruthpillai/reactive-resume:${{ matrix.image }}-${{ steps.version.outputs.current-version }}
- name: Create Sentry Release
uses: getsentry/action-release@v1.2.1
env:
SENTRY_ORG: reactive-resume
SENTRY_PROJECT: ${{ matrix.image }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with:
environment: production
version: ${{ steps.version.outputs.current-version }}

3
client/.gitignore vendored
View File

@ -40,6 +40,3 @@ __ENV.js
# next-sitemap
sitemap*.xml
# sentry
.sentryclirc

View File

@ -21,14 +21,6 @@ COPY --from=dependencies /app/node_modules ./node_modules
COPY --from=dependencies /app/schema/node_modules ./schema/node_modules
COPY --from=dependencies /app/client/node_modules ./client/node_modules
ARG TURBO_TEAM
ARG TURBO_TOKEN
ARG SENTRY_AUTH_TOKEN
ENV TURBO_TEAM $TURBO_TEAM
ENV TURBO_TOKEN $TURBO_TOKEN
ENV SENTRY_AUTH_TOKEN $SENTRY_AUTH_TOKEN
RUN pnpm run build --filter client
FROM base as production

View File

@ -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,11 +15,6 @@ const nextConfig = {
domains: ['cdn.rxresu.me', 'www.gravatar.com'],
},
sentry: {
hideSourceMaps: true,
widenClientFileUpload: true,
},
// Hack to make Tailwind darkMode 'class' strategy with CSS Modules
// Ref: https://github.com/tailwindlabs/tailwindcss/issues/3258#issuecomment-968368156
webpack: (config) => {
@ -53,11 +47,4 @@ const nextConfig = {
},
};
/** @type {import('@sentry/nextjs').SentryWebpackPluginOptions} */
const sentryConfig = {
silent: true,
project: 'client',
dryRun: process.env.NODE_ENV !== 'production',
};
module.exports = withSentryConfig(nextConfig, sentryConfig);
module.exports = nextConfig;

View File

@ -13,44 +13,43 @@
"@emotion/css": "^11.10.5",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@hello-pangea/dnd": "^16.0.1",
"@hello-pangea/dnd": "^16.2.0",
"@hookform/resolvers": "2.9.10",
"@monaco-editor/react": "^4.4.6",
"@mui/icons-material": "^5.10.15",
"@mui/lab": "^5.0.0-alpha.109",
"@mui/material": "^5.10.15",
"@mui/system": "^5.10.15",
"@mui/x-date-pickers": "5.0.8",
"@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",
"@mui/icons-material": "^5.11.0",
"@mui/lab": "^5.0.0-alpha.112",
"@mui/material": "^5.11.0",
"@mui/system": "^5.11.0",
"@mui/x-date-pickers": "5.0.11",
"@next/env": "^13.0.7",
"@react-oauth/google": "^0.5.1",
"@reduxjs/toolkit": "^1.9.1",
"axios": "^1.2.1",
"clsx": "^1.2.1",
"dayjs": "^1.11.6",
"dayjs": "^1.11.7",
"downloadjs": "^1.4.7",
"joi": "^17.7.0",
"lodash": "^4.17.21",
"md5-hex": "^4.0.0",
"monaco-editor": "^0.34.1",
"nanoid": "^3.3.4",
"next": "13.0.5",
"next-i18next": "^13.0.0",
"next": "13.0.7",
"next-i18next": "^13.0.2",
"react": "^18.2.0",
"react-colorful": "^5.6.1",
"react-dnd": "16.0.1",
"react-dnd-html5-backend": "16.0.1",
"react-dom": "^18.2.0",
"react-hook-form": "^7.39.5",
"react-hook-form": "^7.40.0",
"react-hot-toast": "2.4.0",
"react-icons": "^4.6.0",
"react-markdown": "^8.0.3",
"react-icons": "^4.7.1",
"react-markdown": "^8.0.4",
"react-query": "^3.39.2",
"react-redux": "^8.0.5",
"react-zoom-pan-pinch": "^2.1.3",
"redux": "^4.2.0",
"redux-persist": "^6.0.0",
"redux-saga": "^1.2.1",
"redux-saga": "^1.2.2",
"redux-undo": "^1.0.1",
"remark-gfm": "^3.0.1",
"sharp": "^0.31.2",
@ -58,27 +57,27 @@
"webfontloader": "^1.6.28"
},
"devDependencies": {
"@babel/core": "^7.20.2",
"@babel/core": "^7.20.5",
"@reactive-resume/schema": "workspace:*",
"@tailwindcss/typography": "^0.5.8",
"@types/downloadjs": "^1.4.3",
"@types/lodash": "^4.14.190",
"@types/node": "^18.11.9",
"@types/react": "^18.0.25",
"@types/lodash": "^4.14.191",
"@types/node": "^18.11.15",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"@types/react-redux": "^7.1.24",
"@types/tailwindcss": "^3.0.11",
"@types/uuid": "^8.3.4",
"@types/uuid": "^9.0.0",
"@types/webfontloader": "^1.6.35",
"autoprefixer": "^10.4.13",
"csstype": "^3.1.1",
"eslint-config-next": "^13.0.5",
"eslint-plugin-tailwindcss": "^3.7.0",
"eslint-config-next": "^13.0.7",
"eslint-plugin-tailwindcss": "^3.7.1",
"eslint-plugin-unused-imports": "^2.0.0",
"next-sitemap": "^3.1.32",
"postcss": "^8.4.19",
"sass": "^1.56.1",
"next-sitemap": "^3.1.42",
"postcss": "^8.4.20",
"sass": "^1.56.2",
"tailwindcss": "^3.2.4",
"typescript": "^4.9.3"
"typescript": "^4.9.4"
}
}

View File

@ -1,14 +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<ErrorProps> = (props) => <NextErrorComponent statusCode={props.statusCode} />;
CustomErrorComponent.getInitialProps = async (contextData) => {
await Sentry.captureUnderscoreErrorException(contextData);
return NextErrorComponent.getInitialProps(contextData);
};
export default CustomErrorComponent;

View File

@ -1,15 +0,0 @@
import env from '@beam-australia/react-env';
import * as Sentry from '@sentry/nextjs';
import packageJSON from '../package.json';
const SENTRY_DSN = env('CLIENT_SENTRY_DSN');
if (SENTRY_DSN) {
Sentry.init({
dsn: SENTRY_DSN,
tracesSampleRate: 1.0,
release: packageJSON.version,
enabled: process.env.NODE_ENV === 'production',
});
}

View File

@ -1,3 +0,0 @@
defaults.url=https://sentry.io/
defaults.org=reactive-resume
defaults.project=client

View File

@ -1,15 +0,0 @@
import env from '@beam-australia/react-env';
import * as Sentry from '@sentry/nextjs';
import packageJSON from '../package.json';
const SENTRY_DSN = env('CLIENT_SENTRY_DSN');
if (SENTRY_DSN) {
Sentry.init({
dsn: SENTRY_DSN,
tracesSampleRate: 1.0,
release: packageJSON.version,
enabled: process.env.NODE_ENV === 'production',
});
}

View File

@ -1,17 +0,0 @@
import * as Sentry from '@sentry/nextjs';
import { useEffect } from 'react';
import { useAppSelector } from '@/store/hooks';
const SentryWrapper: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
const user = useAppSelector((state) => state.auth.user);
useEffect(() => {
const sentryUser: Sentry.User | null = user && { ...user, id: user?.id.toString() };
Sentry.setUser(sentryUser);
}, [user]);
return <>{children}</>;
};
export default SentryWrapper;

View File

@ -1,15 +1,12 @@
import DateWrapper from './DateWrapper';
import FontWrapper from './FontWrapper';
import SentryWrapper from './SentryWrapper';
import ThemeWrapper from './ThemeWrapper';
const WrapperRegistry: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => (
<ThemeWrapper>
<FontWrapper>
<DateWrapper>
<SentryWrapper>
<>{children}</>
</SentryWrapper>
<>{children}</>
</DateWrapper>
</FontWrapper>
</ThemeWrapper>

View File

@ -21,13 +21,13 @@
"turbo": "^1.6.3"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"eslint": "^8.28.0",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"eslint": "^8.29.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-simple-import-sort": "^8.0.0",
"prettier": "^2.8.0",
"typescript": "^4.9.3"
"prettier": "^2.8.1",
"typescript": "^4.9.4"
},
"resolutions": {
"@types/react": "17.0.2",

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
"build": "tsc"
},
"devDependencies": {
"eslint": "^8.28.0",
"typescript": "^4.9.3"
"eslint": "^8.29.0",
"typescript": "^4.9.4"
}
}

View File

@ -21,14 +21,6 @@ COPY --from=dependencies /app/node_modules ./node_modules
COPY --from=dependencies /app/schema/node_modules ./schema/node_modules
COPY --from=dependencies /app/server/node_modules ./server/node_modules
ARG TURBO_TEAM
ARG TURBO_TOKEN
ARG SENTRY_AUTH_TOKEN
ENV TURBO_TEAM $TURBO_TEAM
ENV TURBO_TOKEN $TURBO_TOKEN
ENV SENTRY_AUTH_TOKEN $SENTRY_AUTH_TOKEN
RUN pnpm run build --filter server
FROM mcr.microsoft.com/playwright:v1.28.0-focal as production

View File

@ -8,29 +8,27 @@
"start": "node dist/main"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.216.0",
"@aws-sdk/client-s3": "^3.231.0",
"@nestjs/axios": "^1.0.0",
"@nestjs/common": "^9.2.0",
"@nestjs/common": "^9.2.1",
"@nestjs/config": "^2.2.0",
"@nestjs/core": "^9.2.0",
"@nestjs/core": "^9.2.1",
"@nestjs/jwt": "^9.0.0",
"@nestjs/mapped-types": "^1.2.0",
"@nestjs/passport": "^9.0.0",
"@nestjs/platform-express": "^9.2.0",
"@nestjs/platform-express": "^9.2.1",
"@nestjs/schedule": "^2.1.0",
"@nestjs/serve-static": "^3.0.0",
"@nestjs/terminus": "^9.1.3",
"@nestjs/terminus": "^9.1.4",
"@nestjs/typeorm": "^9.0.1",
"@sentry/node": "^7.21.1",
"@sentry/tracing": "^7.21.1",
"@types/passport": "^1.0.11",
"bcryptjs": "^2.4.3",
"cache-manager": "^5.1.3",
"cache-manager": "^5.1.4",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.2",
"class-validator": "^0.13.0",
"cookie-parser": "^1.4.6",
"csvtojson": "^2.0.10",
"dayjs": "^1.11.6",
"dayjs": "^1.11.7",
"google-auth-library": "^8.7.0",
"joi": "^17.7.0",
"lodash": "^4.17.21",
@ -46,8 +44,8 @@
"playwright-chromium": "^1.28.1",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.5.7",
"typeorm": "0.3.10",
"rxjs": "^7.8.0",
"typeorm": "0.3.11",
"uuid": "^9.0.0"
},
"devDependencies": {
@ -56,19 +54,19 @@
"@reactive-resume/schema": "workspace:*",
"@types/bcryptjs": "^2.4.2",
"@types/cookie-parser": "^1.4.3",
"@types/express": "^4.17.14",
"@types/lodash": "^4.14.190",
"@types/express": "^4.17.15",
"@types/lodash": "^4.14.191",
"@types/multer": "^1.4.7",
"@types/node": "^18.11.9",
"@types/node": "^18.11.15",
"@types/nodemailer": "^6.4.6",
"@types/passport-jwt": "^3.0.7",
"@types/passport-jwt": "^3.0.8",
"@types/passport-local": "^1.0.34",
"prettier": "^2.8.0",
"prettier": "^2.8.1",
"source-map-support": "^0.5.21",
"ts-loader": "^9.4.1",
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.1.0",
"typescript": "^4.9.3",
"tsconfig-paths": "^4.1.1",
"typescript": "^4.9.4",
"webpack": "^5.75.0"
}
}

View File

@ -1,3 +0,0 @@
defaults.url=https://sentry.io/
defaults.org=reactive-resume
defaults.project=server

View File

@ -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,

View File

@ -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';
@ -60,24 +59,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,
loggingConfig,
mailConfig,
storageConfig,
],
load: [appConfig, authConfig, cacheConfig, databaseConfig, googleConfig, mailConfig, storageConfig],
validationSchema: validationSchema,
}),
],

View File

@ -1,5 +0,0 @@
import { registerAs } from '@nestjs/config';
export default registerAs('logging', () => ({
sentryDSN: process.env.SERVER_SENTRY_DSN,
}));

View File

@ -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<any> {
return next.handle().pipe(
tap(null, (exception) => {
Sentry.captureException(exception);
})
);
}
}

View File

@ -1,10 +1,7 @@
import '@sentry/tracing';
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';
@ -21,19 +18,6 @@ const bootstrap = async () => {
// Pipes
app.useGlobalPipes(new ValidationPipe({ transform: true }));
// Sentry Error Logging
const sentryDSN = configService.get<string>('logging.sentryDSN');
const version = configService.get<string>('app.version');
if (sentryDSN) {
Sentry.init({
dsn: sentryDSN,
release: version,
tracesSampleRate: 1.0,
enabled: process.env.NODE_ENV === 'production',
});
}
// Server Port
const port = configService.get<number>('app.port');
await app.listen(port);

View File

@ -1,19 +1,13 @@
{
"$schema": "https://turborepo.org/schema.json",
"globalDependencies": [".env"],
"pipeline": {
"dev": {
"cache": false
},
"lint": {
"cache": false
},
"start": {
"cache": false
},
"dev": {},
"lint": {},
"start": {},
"build": {
"outputs": ["dist/**", ".next/**"],
"dependsOn": ["^build"]
}
},
"globalDependencies": [".env"]
}
}