Sentry

Error Tracking Software

Create an account or organization in Sentry and a new project. Once you open the project, you will be able to see the following steps to configure Sentry in your current platform.

Install Sentry

In your root folder, just install RavenJS by running the following command:

It is also possible to load it from their official CDN:

Configure Sentry

Next configure Raven.js to use your Sentry DSN:

This should be placed in your main component that wraps the entire platform:

Instead of adding directly the Sentry Endpoint, is better to add it in a .env file or even in a CI.

Additional settings can be found here.

Release Configuration

Sentry enables the user to filter by releases. In case you wanna send it it can be easily added with this line:

In case you are getting these variables from .env, you can get the app version from the package.json:

And then use it in your component like this:

Emit Errors

The best approach to handle errors in React is using Error Boundaries. Just create a component to catch all the errors in your platform and send an event through Raven.

Now, just try to fake by adding throw new Error("Something wrong happened in your app") and see if this new error is reported in your project inside Sentry such as in the image below

Last updated