Skip to content

Commit

Permalink
fix: upgrade Sentry (#1941)
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 authored Jun 9, 2024
1 parent f0c3bc3 commit 4184a7e
Show file tree
Hide file tree
Showing 5 changed files with 1,251 additions and 229 deletions.
6 changes: 3 additions & 3 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@discordjs/rest": "^2.3.0",
"@paralleldrive/cuid2": "^2.2.2",
"@prisma/client": "^5.15.0",
"@sentry/node": "^7.81.0",
"@sentry/node": "^8.8.0",
"@snailycad/audit-logger": "workspace:*",
"@snailycad/config": "workspace:*",
"@snailycad/image-data-uri": "^3.2.0",
Expand Down Expand Up @@ -86,8 +86,8 @@
"prisma": "^5.15.0",
"puppeteer": "^21.5.2",
"qrcode": "^1.5.3",
"reflect-metadata": "^0.1.13",
"sharp": "^0.32.6",
"reflect-metadata": "^0.2.2",
"sharp": "^0.33.4",
"socket.io": "^4.7.5",
"ts-node": "^10.9.2",
"tslib": "^2.6.3",
Expand Down
19 changes: 19 additions & 0 deletions apps/api/src/instrument.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as Sentry from "@sentry/node";

Sentry.init({
dsn: "https://308dd96b826c4e38a814fc9bae681687@o518232.ingest.sentry.io/6553288",
integrations: [
Sentry.httpIntegration(),
Sentry.prismaIntegration(),
Sentry.nestIntegration(),
Sentry.consoleIntegration(),
Sentry.onUnhandledRejectionIntegration(),
Sentry.onUncaughtExceptionIntegration(),
],
tracesSampleRate: 1.0,
profilesSampleRate: 1.0,
attachStacktrace: true,
ignoreErrors: [/can't reach database server at/gim],
denyUrls: [/localhost/],
enabled: process.env.NODE_ENV !== "development",
});
16 changes: 1 addition & 15 deletions apps/api/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "reflect-metadata";
import "./instrument";

import { Server } from "./server";
import { $log } from "@tsed/logger";
Expand All @@ -8,25 +9,10 @@ import { importProviders } from "@tsed/components-scan";
import { getCADVersion } from "@snailycad/utils/version";
import * as Sentry from "@sentry/node";

import { prisma } from "lib/data/prisma";
import { registerDiscordRolesMetadata } from "lib/discord/register-metadata";
import { canSecureCookiesBeEnabled } from "utils/validate-environment-variables";
import { areRequiredCommandsInstalled } from "./utils/validate-requirements";

Sentry.init({
dsn: "https://308dd96b826c4e38a814fc9bae681687@o518232.ingest.sentry.io/6553288",
integrations: [
new Sentry.Integrations.Http({ tracing: true }),
new Sentry.Integrations.Prisma({ client: prisma }),
],
tracesSampleRate: 1.0,
profilesSampleRate: 1.0,
attachStacktrace: true,
ignoreErrors: [/can't reach database server at/gim],
denyUrls: [/localhost/],
enabled: process.env.NODE_ENV !== "development",
});

const rootDir = __dirname;

async function bootstrap() {
Expand Down
6 changes: 1 addition & 5 deletions apps/api/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ if (process.env.NODE_ENV === "development") {
origin: allowedCorsOrigins,
credentials: true,
}),
Sentry.Handlers.requestHandler({
request: true,
serverName: true,
}),
Sentry.Handlers.tracingHandler(),
Sentry.expressErrorHandler(),
],
swagger: [
{
Expand Down
Loading

0 comments on commit 4184a7e

Please sign in to comment.