sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

TypeError: stack.split is not a function

Open alisnic opened this issue 2 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [X] I have reviewed the documentation https://docs.sentry.io/
  • [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/react

SDK Version

7.11.1

Framework Version

React 17.0.2

Link to Sentry event

https://sentry.io/organizations/planable/issues/3541513245/?project=144953&query=is%3Aunresolved

Steps to Reproduce

  1. Do something that generates Meteor.Error
  2. Sentry.captureException(error)
  3. For some errors, Sentry exception is triggered

Expected Result

In JavaScript, everything can be thrown, so Sentry should handle this internally and not complain. Maybe if stack is not according to expected format, add it to issue's Additional Data

Actual Result

Screenshot 2022-08-31 at 12 26 33

alisnic avatar Aug 31 '22 09:08 alisnic

From my debugging, I found out that for some reason, Some Meteor errors have stack nested { stack: { stack: "" }}:

Screenshot 2022-08-31 at 12 40 36

alisnic avatar Aug 31 '22 09:08 alisnic

Hey, thanks for writing in! error.stack should be a string stacktrace as per the MDN docs and the spec proposal (it's non-standard as each browser does it slightly differently).

We can put guards on this to make sure we only parse string stacktraces, but I recommend reaching out to the Meteor folks and asking them to fix the errors generated from Meteor!

AbhiPrasad avatar Aug 31 '22 15:08 AbhiPrasad