From fb9b69c480ccfce1ed651c6025055586b9cc2dd1 Mon Sep 17 00:00:00 2001 From: Sander Bruens Date: Fri, 6 Oct 2023 15:23:53 -0400 Subject: [PATCH 1/2] fix(www): always send the build number as a tag to Sentry --- src/www/app/cordova_main.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/www/app/cordova_main.ts b/src/www/app/cordova_main.ts index 31ceaca9a6..a637dbde77 100644 --- a/src/www/app/cordova_main.ts +++ b/src/www/app/cordova_main.ts @@ -26,7 +26,7 @@ import * as Sentry from '@sentry/browser'; import {AbstractClipboard} from './clipboard'; import {EnvironmentVariables} from './environment'; -import {SentryErrorReporter} from '../shared/error_reporter'; +import {SentryErrorReporter, Tags} from '../shared/error_reporter'; import {main} from './main'; import * as errors from '../model/errors'; import {OutlinePlatform} from './platform'; @@ -70,8 +70,8 @@ async function pluginExecWithErrorCode(cmd: string, ...args: unknown[]): Prom // Adds reports from the (native) Cordova plugin. class CordovaErrorReporter extends SentryErrorReporter { - constructor(appVersion: string, appBuildNumber: string, dsn: string) { - super(appVersion, dsn, {'build.number': appBuildNumber}); + constructor(appVersion: string, dsn: string, tags: Tags) { + super(appVersion, dsn, tags); // Initializes the error reporting framework with the supplied credentials. // TODO(fortuna): This is an Promise that is not waited for and can cause a race condition. // We should fix it with an async factory function for the Reporter. @@ -145,8 +145,8 @@ class CordovaPlatform implements OutlinePlatform { getErrorReporter(env: EnvironmentVariables) { return this.hasDeviceSupport() - ? new CordovaErrorReporter(env.APP_VERSION, env.APP_BUILD_NUMBER, env.SENTRY_DSN || '') - : new SentryErrorReporter(env.APP_VERSION, env.SENTRY_DSN || '', {}); + ? new CordovaErrorReporter(env.APP_VERSION, env.SENTRY_DSN || '', {'build.number': env.APP_BUILD_NUMBER}) + : new SentryErrorReporter(env.APP_VERSION, env.SENTRY_DSN || '', {'build.number': env.APP_BUILD_NUMBER}); } getUpdater() { From b4e3ae73c05c6a139a4e454a528db5991b6c915c Mon Sep 17 00:00:00 2001 From: Sander Bruens Date: Fri, 6 Oct 2023 15:32:56 -0400 Subject: [PATCH 2/2] Use a constant for shared tags. --- src/www/app/cordova_main.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/www/app/cordova_main.ts b/src/www/app/cordova_main.ts index a637dbde77..025d713ecf 100644 --- a/src/www/app/cordova_main.ts +++ b/src/www/app/cordova_main.ts @@ -144,9 +144,10 @@ class CordovaPlatform implements OutlinePlatform { } getErrorReporter(env: EnvironmentVariables) { + const sharedTags = {'build.number': env.APP_BUILD_NUMBER}; return this.hasDeviceSupport() - ? new CordovaErrorReporter(env.APP_VERSION, env.SENTRY_DSN || '', {'build.number': env.APP_BUILD_NUMBER}) - : new SentryErrorReporter(env.APP_VERSION, env.SENTRY_DSN || '', {'build.number': env.APP_BUILD_NUMBER}); + ? new CordovaErrorReporter(env.APP_VERSION, env.SENTRY_DSN || '', sharedTags) + : new SentryErrorReporter(env.APP_VERSION, env.SENTRY_DSN || '', sharedTags); } getUpdater() {