Skip to content

Commit

Permalink
Remove sentry from the backend
Browse files Browse the repository at this point in the history
  • Loading branch information
adrinr committed Oct 18, 2023
1 parent 572cac2 commit ea1853c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 43 deletions.
8 changes: 0 additions & 8 deletions packages/server/src/app.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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 => {
Expand Down
4 changes: 1 addition & 3 deletions packages/server/src/db/linkedRows/LinkController.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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
Expand Down
16 changes: 2 additions & 14 deletions packages/server/src/koa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)

Expand Down
20 changes: 2 additions & 18 deletions packages/worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit ea1853c

Please sign in to comment.