Raven Sentry没有在最新的Angular 4中工作

时间:2017-09-19 22:09:52

标签: javascript angular sentry raven

我正在使用Angular 4创建一个应用程序,我使用Sentry作为远程日志记录平台。

问题是今天我决定将我的软件包更新到他们的最新版本,现在Sentry正在崩溃我的整个应用程序。

这是我的代码:

Raven.config(environment.ravenUrl).install();

export class RavenErrorHandler implements ErrorHandler {
  handleError(err: any): void {
    Raven.captureException(err);
  }
}

@NgModule({
  declarations: [
  // My components
  ],
  imports: [
    BrowserModule,
    ReactiveFormsModule,
    HttpModule,
    AppRoutingModule,
    NgbModule.forRoot(),
    StoreModule.forRoot({
      orders: ordersReducer,
      login: loginReducer,
      routerReducer: routerReducer
    }),
    StoreRouterConnectingModule,
    EffectsModule.forRoot([
      OrderEffect,
      LoginEffect
    ]),
    !environment.production ? StoreDevtoolsModule.instrument() : [],
    PerfectScrollbarModule.forRoot(PERFECT_SCROLLBAR_CONFIG)
  ],
  providers: [
    { provide: ErrorHandler, useClass: RavenErrorHandler }
  ],
  bootstrap: [AppComponent],
})
export class AppModule { }

正如您所看到的,我只是按照Sentry documentation关于如何在Angular上安装它。

我已经对代码进行了一些检查,我看到Raven.config(environment.ravenUrl).install();如果我删除此调用,则错误消失,但我不想这样做。

在Google Chrome上,错误如下:

zone.js:195 Uncaught RangeError: Maximum call stack size exceeded
    at http://localhost:4200/polyfills.bundle.js:5303:31
    at XMLHttpRequest.proto.(anonymous function) (http://localhost:4200/polyfills.bundle.js:3819:24)
    at XMLHttpRequest.open (http://localhost:4200/vendor.bundle.js:17409:37)
    at Raven._makeRequest (http://localhost:4200/vendor.bundle.js:18090:17)
    at Raven._sendProcessedPayload (http://localhost:4200/vendor.bundle.js:18014:56)
    at Raven._send (http://localhost:4200/vendor.bundle.js:17956:22)
    at Raven._processException (http://localhost:4200/vendor.bundle.js:17730:14)
    at Raven._handleStackInfo (http://localhost:4200/vendor.bundle.js:17636:14)
    at Raven.captureException (http://localhost:4200/vendor.bundle.js:16774:18)
    at XMLHttpRequest.wrapped (http://localhost:4200/vendor.bundle.js:16710:22)
    at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:4200/polyfills.bundle.js:2970:31)
    at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (http://localhost:4200/polyfills.bundle.js:2737:47)
    at ZoneTask.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:4200/polyfills.bundle.js:3044:34)
    at invokeTask (http://localhost:4200/polyfills.bundle.js:3972:14)
    at XMLHttpRequest.globalZoneAwareCallback (http://localhost:4200/polyfills.bundle.js:3990:17)
    at http://localhost:4200/polyfills.bundle.js:5303:31
    at XMLHttpRequest.proto.(anonymous function) (http://localhost:4200/polyfills.bundle.js:3819:24)
    at XMLHttpRequest.open (http://localhost:4200/vendor.bundle.js:17409:37)
    at Raven._makeRequest (http://localhost:4200/vendor.bundle.js:18090:17)
    at Raven._sendProcessedPayload (http://localhost:4200/vendor.bundle.js:18014:56)
    at Raven._send (http://localhost:4200/vendor.bundle.js:17956:22)
    at Raven._processException (http://localhost:4200/vendor.bundle.js:17730:14)
    at Raven._handleStackInfo (http://localhost:4200/vendor.bundle.js:17636:14)
    at Raven.captureException (http://localhost:4200/vendor.bundle.js:16774:18)
    at XMLHttpRequest.wrapped (http://localhost:4200/vendor.bundle.js:16710:22)
    at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:4200/polyfills.bundle.js:2970:31)
    at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (http://localhost:4200/polyfills.bundle.js:2737:47)
    at ZoneTask.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:4200/polyfills.bundle.js:3044:34)
    at invokeTask (http://localhost:4200/polyfills.bundle.js:3972:14)
    at XMLHttpRequest.globalZoneAwareCallback (http://localhost:4200/polyfills.bundle.js:3990:17)
    at http://localhost:4200/polyfills.bundle.js:5303:31
    at XMLHttpRequest.proto.(anonymous function) (http://localhost:4200/polyfills.bundle.js:3819:24)
    at XMLHttpRequest.open (http://localhost:4200/vendor.bundle.js:17409:37)
    at Raven._makeRequest (http://localhost:4200/vendor.bundle.js:18090:17)
    at Raven._sendProcessedPayload (http://localhost:4200/vendor.bundle.js:18014:56)
    at Raven._send (http://localhost:4200/vendor.bundle.js:17956:22)
    at Raven._processException (http://localhost:4200/vendor.bundle.js:17730:14)
    at Raven._handleStackInfo (http://localhost:4200/vendor.bundle.js:17636:14)
    at Raven.captureException (http://localhost:4200/vendor.bundle.js:16774:18)
    at XMLHttpRequest.wrapped (http://localhost:4200/vendor.bundle.js:16710:22)
    at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:4200/polyfills.bundle.js:2970:31)
    at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (http://localhost:4200/polyfills.bundle.js:2737:47)
    at ZoneTask.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (http://localhost:4200/polyfills.bundle.js:3044:34)
    at invokeTask (http://localhost:4200/polyfills.bundle.js:3972:14)
    at XMLHttpRequest.globalZoneAwareCallback (http://localhost:4200/polyfills.bundle.js:3990:17)
    at http://localhost:4200/polyfills.bundle.js:5303:31
    at XMLHttpRequest.proto.(anonymous function) (http://localhost:4200/polyfills.bundle.js:3819:24)
    at XMLHttpRequest.open (http://localhost:4200/vendor.bundle.js:17409:37)
    at Raven._makeRequest (http://localhost:4200/vendor.bundle.js:18090:17)
    at Raven._sendProcessedPayload (http://localhost:4200/vendor.bundle.js:18014:56)

在Firefox上我只是得到一个错误,说我已达到递归的最大限制。

这个错误只是在一个无限循环中发生,所以我可以在一秒钟内得到数百个。

还有其他人经历过这个吗?请注意,我使用的是Angular 4.4.2和最新版本的Angular CLI(1.4.2)。

更新

我还发现Chrome上的此错误在最大调用堆栈大小超出错误之前发生了几次错误:

zone.js:195 Uncaught <failed to convert exception to string>
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask  @   zone.js:195
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask   @   zone.js:499
invokeTask  @   zone.js:1427
globalZoneAwareCallback @   zone.js:1445
(anonymous) @   zone.js:2758
proto.(anonymous function)  @   zone.js:1274
(anonymous) @   raven.js:1023
_makeRequest    @   raven.js:1704
_sendProcessedPayload   @   raven.js:1628
_send   @   raven.js:1570
_processException   @   raven.js:1344
_handleStackInfo    @   raven.js:1250
captureException    @   raven.js:388
wrapped @   raven.js:324
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask   @   zone.js:425
webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask  @   zone.js:192
webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask   @   zone.js:499
invokeTask  @   zone.js:1427
globalZoneAwareCallback @   zone.js:1445
(anonymous) @   zone.js:2758
proto.(anonymous function)  @   zone.js:1274
(anonymous) @   raven.js:1023
_makeRequest    @   raven.js:1704
_sendProcessedPayload   @   raven.js:1628
_send   @   raven.js:1570
_processException   @   raven.js:1344
_handleStackInfo    @   raven.js:1250
captureException    @   raven.js:388
wrapped @   raven.js:324
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075
wrapped @   raven.js:321
wrapFn  @   zone.js:1075 

1 个答案:

答案 0 :(得分:1)

这是Zone.js方面的问题,幸运的是已经解决(仍有待发布),请在此处阅读详细信息https://github.com/getsentry/raven-js/issues/1016#issuecomment-328494778