Fixing sentry init.
This commit is contained in:
parent
b0f65526d8
commit
791d74dd94
|
@ -21,7 +21,7 @@ import koaBody from "koa-body"
|
||||||
import http from "http"
|
import http from "http"
|
||||||
import api from "./api"
|
import api from "./api"
|
||||||
import * as redis from "./utilities/redis"
|
import * as redis from "./utilities/redis"
|
||||||
import Sentry from "@sentry/node"
|
const Sentry = require("@sentry/node")
|
||||||
const koaSession = require("koa-session")
|
const koaSession = require("koa-session")
|
||||||
const logger = require("koa-pino-logger")
|
const logger = require("koa-pino-logger")
|
||||||
const destroyable = require("server-destroy")
|
const destroyable = require("server-destroy")
|
||||||
|
@ -46,18 +46,18 @@ app.use(auth.passport.session())
|
||||||
app.use(api.routes())
|
app.use(api.routes())
|
||||||
|
|
||||||
// sentry
|
// sentry
|
||||||
if (env.isProd()) {
|
//if (env.isProd()) {
|
||||||
Sentry.init()
|
Sentry.init()
|
||||||
|
|
||||||
app.on("error", (err, ctx) => {
|
app.on("error", (err, ctx) => {
|
||||||
Sentry.withScope(function (scope: Scope) {
|
Sentry.withScope(function (scope: Scope) {
|
||||||
scope.addEventProcessor(function (event: Event) {
|
scope.addEventProcessor(function (event: Event) {
|
||||||
return Sentry.Handlers.parseRequest(event, ctx.request)
|
return Sentry.Handlers.parseRequest(event, ctx.request)
|
||||||
})
|
|
||||||
Sentry.captureException(err)
|
|
||||||
})
|
})
|
||||||
|
Sentry.captureException(err)
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
|
//}
|
||||||
|
|
||||||
const server = http.createServer(app.callback())
|
const server = http.createServer(app.callback())
|
||||||
destroyable(server)
|
destroyable(server)
|
||||||
|
|
Loading…
Reference in New Issue