crash in raven.js when autobreadcrumbs.xhr is true in angular2 project
I started seeing following crash after upgrading to latest angular2/angular-cli and raven-js. I have narrowed the problem to be happening because of Raven.config().install(). I dont see the crash if I comment out this line.
The crash does not happen if I set autobreadcrumbs.xhr to null.
here is the version of the packages I am using:
"dependencies": { "@angular/common": "2.4.1", "@angular/compiler": "2.4.1", "@angular/core": "2.4.1", "@angular/forms": "2.4.1", "@angular/http": "2.4.1", "@angular/platform-browser": "2.4.1", "@angular/platform-browser-dynamic": "2.4.1", "@angular/router": "3.4.1", "bootstrap": "3.3.7", "core-js": "2.4.1", "raven-js": "3.9.1", "rxjs": "5.0.1", "ts-helpers": "1.1.2", "zone.js": "0.7.4"
Here is the stack trace in chrome:
Unhandled Promise rejection: this.removeAttribute is not a function ; Zone:
Stacktrace in Safari:
console.js:26Unhandled Promise rejection: (8)
"this.removeAttribute is not a function. (In 'this.removeAttribute(prop)', 'this.removeAttribute' is undefined)"
"; Zone:"
"
code around raven.js:1003
var props = ['onload', 'onerror', 'onprogress'];
for (var j = 0; j < props.length; j++) {
wrapProp(props[j], xhr);
}
1003: =====> if ('onreadystatechange' in xhr && isFunction(xhr.onreadystatechange)) { fill(xhr, 'onreadystatechange', function (orig) { return self.wrap(orig, undefined, onreadystatechangeHandler); } /* intentionally don't track this instrumentation */); } else { // if onreadystatechange wasn't actually set by the page on this xhr, we // are free to set our own and capture the breadcrumb xhr.onreadystatechange = onreadystatechangeHandler; }
Having the same issue.

@Starscream27 , here is one workaround I am using in the meantime.
var options = { 'release' : 'a2.1.0', 'autoBreadcrumbs':{'xhr':false}} Raven.config(PUBLIC_DSN, options).install()
zone.js 0.7.2 works fine for me. Seems zone.js 0.7.4 has issue.
@rajendra2 thanks, worked for me
@rajendra2 worked for me! Thanks! !
To me this is not a bug in Raven, this is a real error (unhandled promise rejection) somewhere in your code that is being caught by Raven. I'm guessing this is caused by some AJAX library (jQuery?) that uses a Promise-based API, and the failed XHR is not being handled (e.g. .fail()).
@rajendra2 your fix worked for me, though is this going to stop sending error breadcrumbs to raven?
It has been reported on the zone.js project. You can track it here
The issue seems to have been fixed with [email protected]. Can you check and close accordingly?
@QuentinFchx , yes it seems to have fixed with [email protected]. I am not getting the crash anymore.