Closed komyg closed 2 years ago
I have been using sentry for a while with electron now. I had an issue that sentry wasn't sending reports if use sentry.close method.
Try putting a timeout for 3 seconds before shutdown. Or else you should try to import from /dist/main.
I am not sure if this is a configuration issue, I dont think that it should be.
I'm not sure about this, but it seems to me that your setup would only capture errors in the main process. Are you trying to capture errors in the renderer process instead?
Hey @shahkeyur, thank you for the tips. I did try to import from /dist/main
, but it didn't work.
I also called Sentry.flush()
after sending a few messages to force Sentry, but it also didn't work. However, I didn't manage to delay the app shutdown, but since I called flush
I think I don't need to.
Have you put app.exit in flush callback? If so, try putting timeout before exit.
If you can link to a repository, may be I can help.
I'm not sure about this, but it seems to me that your setup would only capture errors in the main process. Are you trying to capture errors in the renderer process instead?
No, I am trying to capture errors on the main process. I've added sentry browser for the renderer process in an independent setup.
Ok, was just making sure :)
If you can link to a repository, may be I can help.
Sorry, this repo is not open source, so I can't share it with you.
I did manage to make some progress. I changed my import from @sentry/electron
to @sentry/node
for the main process and it worked, I got the events.
Here is my config code, which is called as soon as the apps starts:
import * as Sentry from '@sentry/node';
import { IS_DEVELOPMENT, VERSION } from './settings';
export function configSentry(): void {
if (!IS_DEVELOPMENT) {
Sentry.init({
dsn: 'https://12346@sentry.mydomain/1',
release: VERSION,
});
}
}
But I think that ideally I should use the @sentry/electron
instead of the @sentry/node
right?
@sentry/electron
merges scope and breadcrumbs from all processes in the main process and reports native crashes from all processes with context too.
You won't get any of that if you use @sentry/node
You need to call @sentry/electron
init
in all processes including preload if you're using context isolation.
If any of the above doesn't work with the latest version, please open an issue on the Sentry repo and include a reproduction repository showing any issues and I'll be happy to take a look!
Hi,
I am creating an app using Electron Webpack and Electron builder for Windows and Mac. However I am having some trouble adding Sentry to the Electron main process.
I've added the
@sentry/electron
package and configured using Sentry Init in the main file:But It is not capturing exceptions messages.
I am also using electron-log to capture and log exceptions, but this hasn't work either:
Has anyone been through this? I think that this might be some configuration issue.
Thanks, Komyg