Hi all
In my Ionic Mobile App (Angular) I have the problem that Sentry is causing an infinity loop via change-detection. I don’t know why.
As soon I remove my Sentry.init method call it works! No infinity loop anymore.
Within the developer console I see that instrument.js is causing it and instrument.js
belongs to the @sentry/browser package.
In addition here is my simple Sentry implementation within a simple Angular Error-Service.
As I mentioned. When I remove this Sentry.init() call in the constructor, the app works without infinity loop.
import * as Sentry from '@sentry/browser';
import { Observable, Subject } from 'rxjs';
import { environment, sentryDsn } from '../../environments/environment';
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ErrorService {
lastError: any;
private errors$ = new Subject<any>();
constructor() {
Sentry.init({
dsn: sentryDsn
});
}
watchErrors(): Observable<any> {
return this.errors$;
}
handleError(error: any) {
this.lastError = error;
if (environment.production) {
Sentry.captureException(error.originalError || error);
}
this.errors$.next(error);
}
}
Do you have any idea, why this change detection loop happens?
Thx for every help.
Oliver