From d6aaeea2ab8c09f3f8104bcdadd59e3ba233bb68 Mon Sep 17 00:00:00 2001 From: Tomi Turtiainen <10324676+tomi@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:52:39 +0300 Subject: [PATCH] fix: Load sentry for task runner server only if configured (no-changelog) (#11420) --- packages/cli/src/runners/task-runner-server.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/runners/task-runner-server.ts b/packages/cli/src/runners/task-runner-server.ts index 5baaf9fc90..2199e70b38 100644 --- a/packages/cli/src/runners/task-runner-server.ts +++ b/packages/cli/src/runners/task-runner-server.ts @@ -125,11 +125,13 @@ export class TaskRunnerServer { const { app } = this; // Augment errors sent to Sentry - const { - Handlers: { requestHandler, errorHandler }, - } = await import('@sentry/node'); - app.use(requestHandler()); - app.use(errorHandler()); + if (this.globalConfig.sentry.backendDsn) { + const { + Handlers: { requestHandler, errorHandler }, + } = await import('@sentry/node'); + app.use(requestHandler()); + app.use(errorHandler()); + } } private setupCommonMiddlewares() {