Sentry-javascript: captureMessage on IE8 does not send message to Sentry

Created on 8 Mar 2017  路  6Comments  路  Source: getsentry/sentry-javascript

Sentry version: 3.12.1 (self-hosted).
OS & browser: Windows 7 & IE8
Performing Raven.captureMessage('Any string'); from within our window.onerror.

Managed to capture the exception message for this:
Object doesn't support this property or method

Additionally, the events ravenSuccess and ravenError are not triggered, even with the workaround below.

Raven is configured and installed as per the docs, and works for the other browsers (barring IE7).

Since it's a bit of a catch 22 trying to debug IE8, I used alerts to narrow down the line where it fails: -
Line 1714

request.send(stringify(opts.data));

and more specifically, the stringify function is failing.
Directly sending JSON.stringify(opts.data) works.

Apologies if this issue tone is a bit staccato, but any fix is appreciated!

All 6 comments

I've confirmed this on my end. AFAIK, "regular" exception (e.g. captureException, onerror) handling seems fine.

Will look into a fix asap.

Core issue boils down to json-stringify-safe using Array.prototype.indexOf (see isaacs/json-stringify-safe/issues/6), while IE8 only has String.prototype.indexOf. We're going to vendor in the json-stringify-safe dependency and modify it to avoid this.

Thanks for looking into this!

@benvinegar

I've confirmed this on my end. AFAIK, "regular" exception (e.g. captureException, onerror) handling seems fine.

On the contrary, removing our window.onerror (so it is just left with Raven) does not send anything to Sentry via its "regular" method (i.e. not calling captureException() manually ) on IE8.

Debug time:

  • Nothing is wrapped on IE8 (or it's not called at any point) like it does on ffx and Chrome & IE9+, so I believe Raven falls back to its global onerror handler, which is traceKitWindowOnError?
  • This notifies handlers, which in this case is _handleOnErrorStackInfo
  • Calls _handleStackInfo
  • Calls _processException
  • Calls _send
  • Calls _sendProcessedPayload
  • Calls _makeRequest
  • Calls stringify
  • serializer() seems to be fine
  • The JSON.stringify seems to fail
  • Stuck a try-catch around it and received the same error message: Object doesn't support this property or method
  • Nothing is sent

On the contrary, removing our window.onerror (so it is just left with Raven) does not send anything to Sentry via its "regular" method (i.e. not calling captureException() manually ) on IE8.

Yeah, @LewisJEllis corrected me on this yesterday 鈥撀爋ur example test page "intentionally" has whitelistUrls set to reject the error. I did not see an exception thrown because it was suppressed.

Fantastic work gents, will get this into production.

Was this page helpful?
0 / 5 - 0 ratings