From 4266cc974ae4528fee69e1d40207c2a50995c80c Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Tue, 14 May 2024 17:51:48 +0200 Subject: [PATCH] Sentry: Fix broken `configureScope()` call `configureScope()` has apparently been deprecated a while ago and was recently removed in https://github.com/getsentry/sentry-javascript/pull/9887. Since we are mocking Sentry in our test suite we unfortunately didn't notice the issue before it popped up on our staging environment. --- app/routes/application.js | 2 +- app/services/sentry.js | 4 ++-- tests/helpers/sentry.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/routes/application.js b/app/routes/application.js index 5ecf8c8de10..d7467f97ec7 100644 --- a/app/routes/application.js +++ b/app/routes/application.js @@ -77,7 +77,7 @@ export default class ApplicationRoute extends Route { setSentryTransaction(transition) { let name = transition.to?.name; if (name) { - this.sentry.configureScope(scope => scope.setTransactionName(name)); + this.sentry.getCurrentScope().setTransactionName(name); } } } diff --git a/app/services/sentry.js b/app/services/sentry.js index 57c3167274a..232aa041483 100644 --- a/app/services/sentry.js +++ b/app/services/sentry.js @@ -7,8 +7,8 @@ export default class SentryService extends Service { Sentry.captureException(error, captureContext); } - configureScope(callback) { - Sentry.configureScope(callback); + getCurrentScope() { + return Sentry.getCurrentScope(); } setUser(user) { diff --git a/tests/helpers/sentry.js b/tests/helpers/sentry.js index 61f4aa8cb5b..cc732d8d7fe 100644 --- a/tests/helpers/sentry.js +++ b/tests/helpers/sentry.js @@ -11,8 +11,8 @@ class MockSentryService extends Service { this.events.push(event); } - configureScope(callback) { - callback(this.scope); + getCurrentScope() { + return this.scope; } setUser(user) {