Skip to content

Commit 5c6b5b8

Browse files
committed
fix: Setup Sentry only when Desktop is onboarded
We need a valid Desktop config to setup our Sentry integration as we use the Cozy URL to determine the domain, the instance and the environment of the Cozy to tag our events. Since we want to receive events as soon as possible, we setup Sentry very early and, when Desktop is not onboarded already, we get an error since we don't have the required data. This is not a big deal but the error is printed in the console. We'll now make sure we have a valid configuration before trying to setup the integration and we'll also make sure to set it up after the onboarding is done to receive events without the need for an app restart.
1 parent 1d651b1 commit 5c6b5b8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gui/main.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ if (!mainInstance && !process.env.COZY_DESKTOP_PROPERTY_BASED_TESTING) {
7171
app.exit()
7272
}
7373

74-
let desktop = new Desktop.App(process.env.COZY_DESKTOP_DIR)
75-
sentry.setup(desktop.clientInfo())
74+
const desktop = new Desktop.App(process.env.COZY_DESKTOP_DIR)
75+
if (desktop.config.cozyUrl) {
76+
sentry.setup(desktop.clientInfo())
77+
}
7678

7779
let diskTimeout = null
7880
let onboardingWindow = null
@@ -650,6 +652,7 @@ app.on('ready', async () => {
650652
log.trace('Setting up onboarding WM...')
651653
onboardingWindow = new OnboardingWM(app, desktop)
652654
onboardingWindow.onOnboardingDone(async () => {
655+
sentry.setup(desktop.clientInfo())
653656
await setupDesktop()
654657
onboardingWindow.hide()
655658
await trayWindow.show()

0 commit comments

Comments
 (0)