Skip to content

Commit

Permalink
Fix: Command sentry
Browse files Browse the repository at this point in the history
- sentry 관련 빌드에러로 인해 임시 주석처리
  • Loading branch information
sally0226 committed Jul 4, 2024
1 parent 8cef837 commit 19f11c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "commonjs",
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build && pnpm sentry:sourcemaps",
"build": "nest build # && pnpm sentry:sourcemaps",
"migrate:create:dev": "dotenv -e .development.env -- npx mikro-orm migration:create",
"migrate:up:dev": "dotenv -e .development.env -- npx mikro-orm migration:up",
"show:database:schema": "dotenv -e .development.env -- npx mikro-orm schema:create --dump",
Expand Down
10 changes: 5 additions & 5 deletions src/core/exception-filters/custom-exception.filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@nestjs/common';
import { ConfigService } from '@nestjs/config';

import * as Sentry from '@sentry/nestjs';
// import * as Sentry from '@sentry/nestjs';
import { Response } from 'express';

import { EnvType } from 'src/common/helper/env.validation';
Expand Down Expand Up @@ -53,17 +53,17 @@ export class CustomExceptionFilter implements ExceptionFilter {
`api : ${request.method} ${request.url} message : ${exception.message}`,
);
if (!this.utilService.isDev()) {
this.sendErrorToSentry(exception);
// this.sendErrorToSentry(exception);
await this.sendErrorInfoToDiscord(request, exception);
}
}

response.status(responseBody.statusCode).json(responseBody);
}

private sendErrorToSentry(exception: Error) {
Sentry.captureException(exception);
}
// private sendErrorToSentry(exception: Error) {
// Sentry.captureException(exception);
// }

private async sendErrorInfoToDiscord(request: Request, error: Error) {
const discordWebhook = this.configService.get('DISCORD_WEBHOOK_URL');
Expand Down
20 changes: 10 additions & 10 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';

import * as Sentry from '@sentry/nestjs';
import { nodeProfilingIntegration } from '@sentry/profiling-node';
// import * as Sentry from '@sentry/nestjs';
// import { nodeProfilingIntegration } from '@sentry/profiling-node';
import cookieParser from 'cookie-parser';

import { CustomExceptionFilter } from 'src/core/exception-filters/custom-exception.filter';
Expand All @@ -17,14 +17,14 @@ import { UtilService } from './util/util.service';
async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(AppModule);

Sentry.init({
dsn: 'https://d3012af412384e4e0387dc84839e5eee@o4507516567945216.ingest.us.sentry.io/4507516570697728',
integrations: [nodeProfilingIntegration()],

tracesSampleRate: 1.0,

profilesSampleRate: 1.0,
});
// Sentry.init({
// dsn: 'https://d3012af412384e4e0387dc84839e5eee@o4507516567945216.ingest.us.sentry.io/4507516570697728',
// integrations: [nodeProfilingIntegration()],
//
// tracesSampleRate: 1.0,
//
// profilesSampleRate: 1.0,
// });

const configService = app.select(AppModule).get(ConfigService);
const utilService = new UtilService(configService);
Expand Down

0 comments on commit 19f11c9

Please sign in to comment.