From 791d74dd94eec2d9f438996f4b040978ebe46c5e Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Tue, 29 Nov 2022 15:38:25 +0000 Subject: [PATCH] Fixing sentry init. --- packages/worker/src/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/worker/src/index.ts b/packages/worker/src/index.ts index b513b11279..50fb2fcb8d 100644 --- a/packages/worker/src/index.ts +++ b/packages/worker/src/index.ts @@ -21,7 +21,7 @@ import koaBody from "koa-body" import http from "http" import api from "./api" import * as redis from "./utilities/redis" -import Sentry from "@sentry/node" +const Sentry = require("@sentry/node") const koaSession = require("koa-session") const logger = require("koa-pino-logger") const destroyable = require("server-destroy") @@ -46,18 +46,18 @@ app.use(auth.passport.session()) app.use(api.routes()) // sentry -if (env.isProd()) { - Sentry.init() +//if (env.isProd()) { +Sentry.init() - app.on("error", (err, ctx) => { - Sentry.withScope(function (scope: Scope) { - scope.addEventProcessor(function (event: Event) { - return Sentry.Handlers.parseRequest(event, ctx.request) - }) - Sentry.captureException(err) +app.on("error", (err, ctx) => { + Sentry.withScope(function (scope: Scope) { + scope.addEventProcessor(function (event: Event) { + return Sentry.Handlers.parseRequest(event, ctx.request) }) + Sentry.captureException(err) }) -} +}) +//} const server = http.createServer(app.callback()) destroyable(server)