getsentry / sentry-electron

The official Sentry SDK for Electron
https://sentry.io/
MIT License
224 stars 58 forks source link

Electron process running multiple times after init sentry in main process #974

Open arjunByldd01 opened 3 months ago

arjunByldd01 commented 3 months ago

Steps to Reproduce

I implemented sentry using your doc

I created sentry.init.main and sentry.init.renderer file, and I added code that mentioned in doc for main and renderer. After this I imported these files in main and renderer process.

when I start my application it creates two tray icon. In other words it run my window creation process twice. And on sentry it shows this error - Attempted to register a second handler for 'window-minimize'

Can you help me to understand what's this behaviour is

//sentry.init.main 
import * as Sentry from '@sentry/electron/main';
import { session } from 'electron';

Sentry.init({
  dsn: envConfig.SENTRY_DSN,
  debug: true,
  ipcMode: Sentry.IPCMode.Protocol,
  getSessions: () => [session.defaultSession, session.fromPartition('persist:my-session')],
});
import * as Sentry from '@sentry/electron/renderer';
//sentry.init.renderer

Sentry.init({
  integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],

  tracesSampleRate: 1.0,

  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,
});

I also run the wizard command mentioned in doc command - npm install -g @sentry/wizard sentry-wizard --integration electron

Expected Result

It should not run electron process twice

Actual Result

When I run my app it runs all my electron process twice and also created two tray icon for my app.

Additional Info

No response

getsantry[bot] commented 3 months ago

Assigning to @getsentry/support for routing ⏲️

mydea commented 1 week ago

Hey, I've transferred this issue to the sentry-electron repo.

@timfish could you take a look?

timfish commented 1 week ago

@arjunByldd01 do you have a more complete example app that replicates this issue?

We've got extensive e2e tests where this doesn't occur and this issue has not been reported before so I suspect the issue is caused by code that has not been supplied!