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

View File

@ -1,6 +1,5 @@
import { IncludeDocs, getLinkDocuments } from "./linkUtils" import { IncludeDocs, getLinkDocuments } from "./linkUtils"
import { InternalTables, getUserMetadataParams } from "../utils" import { InternalTables, getUserMetadataParams } from "../utils"
import Sentry from "@sentry/node"
import { FieldTypes } from "../../constants" import { FieldTypes } from "../../constants"
import { context } from "@budibase/backend-core" import { context } from "@budibase/backend-core"
import LinkDocument from "./LinkDocument" import LinkDocument from "./LinkDocument"
@ -434,8 +433,7 @@ class LinkController {
await this._db.put(linkedTable) await this._db.put(linkedTable)
} }
} catch (err) { } catch (err) {
/* istanbul ignore next */ // Ignored error
Sentry.captureException(err)
} }
} }
// need to get the full link docs to delete them // 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 { Thread } from "./threads"
import * as redis from "./utilities/redis" import * as redis from "./utilities/redis"
import { events, logging, middleware, timers } from "@budibase/backend-core" import { events, logging, middleware, timers } from "@budibase/backend-core"
const Sentry = require("@sentry/node") import destroyable from "server-destroy"
const destroyable = require("server-destroy") import { userAgent } from "koa-useragent"
const { userAgent } = require("koa-useragent")
export default function createKoaApp() { export default function createKoaApp() {
const app = new Koa() const app = new Koa()
@ -36,17 +35,6 @@ export default function createKoaApp() {
app.use(middleware.pino) app.use(middleware.pino)
app.use(userAgent) 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()) const server = http.createServer(app.callback())
destroyable(server) destroyable(server)

View File

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