Remove sentry from the backend

This commit is contained in:
Adria Navarro 2023-10-17 11:11:08 +02:00
parent 862fbff45d
commit 0b1bfdee6b
4 changed files with 5 additions and 43 deletions

View File

@ -1,11 +1,7 @@
import * as Sentry from "@sentry/node"
if (process.env.DD_APM_ENABLED) {
require("./ddApm")
}
// need to load environment first
import env from "./environment"
import * as db from "./db"
db.init()
import { ServiceType } from "@budibase/types"
@ -28,10 +24,6 @@ async function start() {
}
// startup includes automation runner - if enabled
await startup(app, server)
if (env.isProd()) {
env._set("NODE_ENV", "production")
Sentry.init()
}
}
start().catch(err => {

View File

@ -1,6 +1,5 @@
import { IncludeDocs, getLinkDocuments } from "./linkUtils"
import { InternalTables, getUserMetadataParams } from "../utils"
import Sentry from "@sentry/node"
import { FieldTypes } from "../../constants"
import { context } from "@budibase/backend-core"
import LinkDocument from "./LinkDocument"
@ -434,8 +433,7 @@ class LinkController {
await this._db.put(linkedTable)
}
} catch (err) {
/* istanbul ignore next */
Sentry.captureException(err)
// Ignored error
}
}
// need to get the full link docs to delete them

View File

@ -8,9 +8,8 @@ import * as automations from "./automations"
import { Thread } from "./threads"
import * as redis from "./utilities/redis"
import { events, logging, middleware, timers } from "@budibase/backend-core"
const Sentry = require("@sentry/node")
const destroyable = require("server-destroy")
const { userAgent } = require("koa-useragent")
import destroyable from "server-destroy"
import { userAgent } from "koa-useragent"
export default function createKoaApp() {
const app = new Koa()
@ -36,17 +35,6 @@ export default function createKoaApp() {
app.use(middleware.pino)
app.use(userAgent)
if (env.isProd()) {
app.on("error", (err: any, ctx: ExtendableContext) => {
Sentry.withScope(function (scope: any) {
scope.addEventProcessor(function (event: any) {
return Sentry.Handlers.parseRequest(event, ctx.request)
})
Sentry.captureException(err)
})
})
}
const server = http.createServer(app.callback())
destroyable(server)

View File

@ -4,8 +4,6 @@ if (process.env.DD_APM_ENABLED) {
// need to load environment first
import env from "./environment"
import { Scope } from "@sentry/node"
import { Event } from "@sentry/types/dist/event"
import Application from "koa"
import { bootstrap } from "global-agent"
import * as db from "./db"
@ -25,9 +23,9 @@ import koaBody from "koa-body"
import http from "http"
import api from "./api"
import * as redis from "./utilities/redis"
const Sentry = require("@sentry/node")
const koaSession = require("koa-session")
const { userAgent } = require("koa-useragent")
import { userAgent } from "koa-useragent"
import destroyable from "server-destroy"
import { initPro } from "./initPro"
@ -66,20 +64,6 @@ app.use(auth.passport.session())
// api routes
app.use(api.routes())
// sentry
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)
})
})
}
const server = http.createServer(app.callback())
destroyable(server)