Vue electron. Which sdk should I choose?

I am building an vue electron based application, and I am still wondering should I use vue or electron SDK to integrate with sentry?

Will I get log data of vuex mutations or data state?

So you should use our electron SDK: https://github.com/getsentry/sentry-electron
And in the renderer you can use our Vue integration
https://docs.sentry.io/platforms/javascript/vue/

You just have to change the import from @sentry/browser to @sentry/electron.

What do you mean by using Vue integration in the renderer? I didn’t get that part. :thinking:

It’s basically just adding this in the init call of Sentry:

integrations: [new Sentry.Integrations.Vue({ 
    Vue,
    attachProps: true
  })]

With that you’ll get our Vue support.

Electron has a processes running node and processes running chromium (renderer).

What our Electron SDK does is that for the node processes it usese @sentry/node and for the renderer @sentry/browser.

Awesome, thanks for the help.

I am getting this error.

image

BTW, I forget to ask, do I need to add this to main or render process.

Sentry.init({
	dsn: "https://@sentry.io/",
	integrations: [new Sentry.Integrations.Vue({
		Vue,
		attachProps: true
	})]
})

If I add Vue integration part in render process, wouldn’t it will be duplication of DSN, one in main and render process.

Hey, sorry it isn’t super obvious.
This code should do the trick:

const { init, getIntegrations } = require('@sentry/electron');

if (getIntegrations && getIntegrations().browser) {
  // We are running in the renderer
  const VueIntegration = getIntegrations().browser.Vue;
  init({
    dsn: 'DSN',
    debug: true,
    integrations: [new VueIntegration()],
  });
} else {
  // We are running in the main process
  init({
    dsn: 'DSN',
  });
}

Hmm… okay.

Hey - I’ve used your example - also added sentry to the main process.
It looks like Vue errors are not caught by Sentry…

Should you script be loaded with preload option in the main process?

Edit: Could resolve the issue: https://github.com/getsentry/sentry-electron/issues/172