Angular- Following the instructions does not seem to activate sentry

Hi, I’m trying to implement sentry in my project and I cant get it to work.

I’m using angular 6 , I run npm install @sentry/browser and then copied the code from the instructions into my main module (app.module.ts).

import * as Sentry from "@sentry/browser";

Sentry.init({
  dsn: "https://somenumbers@sentry.io/somenumbers"
});

@Injectable()
export class SentryErrorHandler implements ErrorHandler {
  constructor() { }
  handleError(error) {
    Sentry.captureException(error.originalError || error);
    throw error;
  }
}

No syntax errors, I imported ErrorHandler and Injectable from angular core.

Now I want to test this. I’m on my local computer (already tested that the filter for localhost in sentry settings is off) and I create a syntax error on one of the views of an angular component. then I navegate to that component and I get a nice error on my debug console but I dont get any events in sentry.

Is this how it’s supposed to work? Shouldnt i get a report?

1 Like

I’ve experienced the same issue. Any advice?

When I write a console.log statement within the handleError(error) method, I see the logged out statement in the console - so, the app is definitely hitting the line of Sentry.captureException… only, nothing is getting sent to the Sentry servers. Also, when I view Network activity in my browser, there does not seem to be any. thanks.