Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stacktrace and source maps for servedside #184

Open
iliyaZelenko opened this issue May 29, 2020 · 7 comments
Open

Fix stacktrace and source maps for servedside #184

iliyaZelenko opened this issue May 29, 2020 · 7 comments
Labels

Comments

@iliyaZelenko
Copy link

What problem does this feature solve?

It will not be necessary to use $sentry.captureException(error) to catch an error everywhere as described here, each error will be logged itself if it appears in asyncData.

What does the proposed changes look like?

I want the error to be caught through this module, for example, in this code:

async asyncData ({ params }) {
  if (params.id === '123') throw Error('Test error')

  someFunctionThatCanThrowError()
}

That is, not to write like this:

async asyncData ({ params }) {
  if (params.id === '123') {
    $sentry.captureException(Error('Test error'))
  }

  try {
    someFunctionThatCanThrowError()
  } catch (e) {
    $sentry.captureException(e)
  }
}
This feature request is available on Nuxt community (#c97)
@rchl
Copy link
Member

rchl commented May 29, 2020

I think the exception will be caught regardless.

The linked example is probably just an example of usage and an example of how to capture the exception and not make the page crash.

Do you actually have an issue with exceptions not being captured from asyncData?

@iliyaZelenko
Copy link
Author

I was my mistake, in fact it seems to work.

I have another problem: the stacktrace in such an error looks very strange. I use souremaps, if an error occurs on the client side, then I can clearly see stacktrace.

Error in asyncData:

image

Error on client side:

image

As you can see, on client side the stacktrace is clear, I can understand where the error occurred, on the server side everything is different. Are there any ways to improve this?

@rchl
Copy link
Member

rchl commented May 29, 2020

Yes, I think I might have had issues with that too (don't get server-side errors often so didn't bother analyzing).

I think it's a matter of either:

  • wrong source map setting for the server build
  • something wrong with matching source-maps on Sentry (possibly due to the module using the wrong prefix)

I'd need to analyze this at some point but any help is welcome.

@iliyaZelenko
Copy link
Author

iliyaZelenko commented May 29, 2020

This will very-very help in debugging errors, I have a lot of code on the server side and it is not possible to transfer it to the client side in order to finally see sourcemaps. I look forward to news on this topic, keep me posted. Thanks for the quick answers!

How i use module:

      ['@nuxtjs/sentry', {
        publishRelease: true,
        webpackConfig: {
          silent: [process.env.IS_PROD, process.env.IS_TESTBB].includes('true')
        }
      }],

Also i have scuh env variables:

SENTRY_DSN=***
SENTRY_AUTH_TOKEN=***
SENTRY_ORG=sentry
SENTRY_PROJECT=***
# this defaults to https://sentry.io/.
SENTRY_URL=http://sentry.testbb.ru

@iliyaZelenko iliyaZelenko changed the title Auto capture exceptions in asyncData Fix stacktrace and source maps for servedside May 29, 2020
@rchl rchl added the bug label Jul 23, 2020
@rchl
Copy link
Member

rchl commented Jul 24, 2020

I forgot to post here it seems but the issue is partially analyzed and seems a bit hard to fix without changes in Nuxt. See nuxt/nuxt#7461 which talks about just local server-side debugging with source maps but it should be relevant.

(There is a chance that those issues are not related.)

@BenjaminGK
Copy link

@rchl any updates on this issue? We are facing this issue as well.
We have a single sentry project where we send both node and JS issues to.
We are using the latest version of the module but even though we specify in the publishRelease section the release name to be 'project@versionNumber' I can see in the sentry release file generated in The nuxt folder shows a sha key or similar.

@rchl
Copy link
Member

rchl commented Jan 23, 2024

Doesn't seem like a related issue (not creating releases properly vs. not able to see proper stack traces on server).

Sounds like a configuration issue. Create a new issue or discussion with all the details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants