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

Increase the number of frames in axios stack traces? #3528

Closed
Tofandel opened this issue May 11, 2021 · 2 comments
Closed

Increase the number of frames in axios stack traces? #3528

Tofandel opened this issue May 11, 2021 · 2 comments

Comments

@Tofandel
Copy link

Tofandel commented May 11, 2021

By default the fingerprinting uses the stack trace, but it only uses the last 5 function calls, is it possible to increase this somehow? (7 would be much better)

Because with axios a stack trace of 5 functions is not enough to go back to the line that caused the issue.. And so I'm getting tons of unrelated errors merged together

Example
Event 1
image
image

Event 2
image
image

And the stack trace in the sentry UI is completely useless, only the breadcrumbs gives me some indication of the issue :(

Am I getting this right that the stack trace is limited to 5 or is it actually an issue with the fact that the error occurs asynchronously from what caused it?

What kind of setting change can I do to improve this?

@kamilogorek
Copy link
Contributor

Am I getting this right that the stack trace is limited to 5 or is it actually an issue with the fact that the error occurs asynchronously from what caused it?

It is actually an issue with axios. We don't limit stacktraces in any way.

https://github.com/axios/axios/blob/master/lib/core/createError.js
https://github.com/axios/axios/blob/master/lib/core/enhanceError.js

The stacktrace is created not on the call-site, but rather during new Error call, in createError.js, and it's not overridden in enhanceError afterwards.

You can play around with extracting the data out of it yourself, using isAxiosError flag they provide.

Sentry.init({
  beforeSend(event, hint) {
    if (hint.originalException?.isAxiosError) {
      // do some extraction magic from request, response, code or anything else
    }
    return event;
  }
})

or you can use https://docs.sentry.io/platforms/node/configuration/integrations/pluggable-integrations/#extraerrordata integration that will do that for you.

Cheers!

@lobsterkatie lobsterkatie changed the title Increase the number of stack traces? Increase the number of frames in axios stack traces? Jul 22, 2021
@mdefeche
Copy link

Leaving a comment for those who might have the same issue.

The issue came from an old version of Axios with this issue axios/axios#4718. Upgrading to the latest issue fixed it.

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

No branches or pull requests

4 participants