DEV Community

Cover image for Tracking errors in Angular with Sentry

Tracking errors in Angular with Sentry

Nils Mehlhorn on August 13, 2019

Originally published at nils-mehlhorn.de Do you know what's going on in your Angular app when it's live? While common to have logging set up on th...
Collapse
 
fallenritemonk profile image
FallenRiteMonk

A quick question: I constantly have problems on setting up the source-maps if I don't provide them on the web-space along side the js files. Could you add some explanation on how to upload source-maps the right way using sentry-cli?
Would be really helpful. Thanks

Collapse
 
n_mehlhorn profile image
Nils Mehlhorn

Angular will generate source maps for you which you can serve alongside your regular assets and Sentry will just pick them up. Browsers won't load them until you open the developer tools - therefore that's what I do.

Alternatively, if you don't won't to serve the source maps, you'd upload them to Sentry for every release. Here are the docs on that: docs.sentry.io/platforms/javascrip...

Collapse
 
constjs profile image
Piotr Lewandowski

You're assuming error can contain "originalError" property, I'm seeing this for first time - how such error can happen?

handleError(error) {
    error.originalError || error
  }
Collapse
 
n_mehlhorn profile image
Nils Mehlhorn • Edited

Angular's zone might wrap occurring errors in order to have error messages point to the place where an error occurred initially. You can see this in the sources here:

I couldn't find any precise docs on that, yet it's also done like this in the Sentry official examples. Therefore I thought it's best to keep the check in there.

Collapse
 
rakeshkv profile image
Rakesh kv

Nice article, I'll give a try ❤️

Collapse
 
martinandersen profile image
Martin Andersen

I am having a hard time finding out if the server software is free. I want to host Sentry on AWS

Collapse
 
n_mehlhorn profile image
Nils Mehlhorn

Well, here's the license: github.com/getsentry/sentry/blob/m...

And here it's confirmed by a staff member: forum.sentry.io/t/is-running-a-sen...

After a quick search I also found posts about how to host on AWS :)

Collapse
 
martinandersen profile image
Martin Andersen

Thank for the answer. Do you know where I can download the server software?

Thread Thread
 
n_mehlhorn profile image
Nils Mehlhorn

Here's the official installation guide: docs.sentry.io/server/installation/

Collapse
 
lonlilokli profile image
Lonli-Lokli

Have you considered integration with other players on the market, like bugsnag?