nuxt-community / sentry-module

Sentry module for Nuxt 2
https://sentry.nuxtjs.org
MIT License
500 stars 113 forks source link

Segmentation fault with 7.1.5 #549

Closed fellnerse closed 1 year ago

fellnerse commented 1 year ago

Version

@nuxtjs/sentry: 7.1.5 nuxt: 2.14.12

Sentry configuration

empty

Steps to reproduce

I wanted to update sentry from version 5 to the latest but got segmentation faults when building:

yarn run v1.22.17
$ NUXT_ENV_LOCAL=1 nuxt
ℹ Parsed 4 files in 0,2 seconds                                                                                                                                                                                                                       @nuxt/content 08:44:56

 WARN  Workbox is running in development mode                                                                                                                                                                                                                       08:44:56

error Command failed with signal "SIGSEGV".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What is Expected?

Should not throw this error

What is actually happening?

I could pinpoint it down to the 7.1.5 version, with 7.1.4 I do not jet have the problem.

rchl commented 1 year ago

Can you try the latest version of the module?

rchl commented 1 year ago

I suppose you have tried latest version already...

In that case i would probably need a project that reproduces since the error doesn't have any useful information.

But if it fails due to either node version or Nuxt version being too old then I would not consider it a module bug. So you might want to verify if it works with latest Nuxt 2 and node 16.

Between those two versions it has been changed how module is built but it shouldn't have caused any observable changes to module users, in theory.

fellnerse commented 1 year ago

ok will update nuxt and sentry to latest; im using node 16 already

fellnerse commented 1 year ago

So this seems to work and I can build the project; everything seems to be fine. But now I have the issue that the beforeSend function in the sentry config in the nuxt config somehow has an issue with the showReportDialog:

      beforeSend(event) {
        console.log("before send", event, event.exception);
        console.log("why are we not sending", showReportDialog);
        if (event.exception) {
          console.log("why are we not sending", showReportDialog);
          showReportDialog({ eventId: event.event_id });
        }
        return event;
      },

I get the first log, but the second one is swallowed. The function itself is defined, i print it during building and I get output.

I import it like this:

import { showReportDialog } from '@sentry/vue'
rchl commented 1 year ago

Where is that code located? It wouldn't work from nuxt.config.js.

fellnerse commented 1 year ago

yes its in the nuxt.config.js with the old versions this seems to work. what are you suggesting how i should do it instead?

rchl commented 1 year ago

I don't know why would it work in old version. It shouldn't since the beforeSend function is serialized and triggered from the webpack context so it wouldn't see your showReportDialog import there.

The way to do that would be through an external client config file: https://sentry.nuxtjs.org/sentry/options#clientconfig

fellnerse commented 1 year ago

Aaah ok thanks for the explanation, probably because of the dev build it works;

one thing that would make sense in my opinion is to update the minimum nuxt version requirement here: https://sentry.nuxtjs.org/guide/setup/

rchl commented 1 year ago

Not sure what is the minimum version. I could try to test and check but it could be that it's the sub-dependencies versions that are relevant here in which case the issue wouldn't even be directly related to Nuxt version.