How to use Sentry
Advices and “must-know” things regarding Sentry usage.
Table of contents
Using ALERT_TYPES
NRN comes with built-in ALERT_TYPES
for existing alerts, defined in the sentry.ts
file.
Feel free to add more alert types, they’re mostly useful to help you increase the observability of your backend, by helping you to make sense of what’s happening.
Dependencies
@sentry/browser
: Package to use from the browser.@sentry/node
: Package to use from the server.
Sentry provides 2 different packages, with different abilities (but a very similar API) for browser and server usage.
A note about @sentry/node
usage (Webpack trick)
In the source code, we always use @sentry/node
, which is automatically converted at build step by Webpack. (see next.config.js
)
This way, we always use the same import, which is linked to the right package based on the runtime engine target.
What about @sentry/react
?
Resources
- https://sentry.io/welcome/
- https://docs.sentry.io/
- Official “Getting started” guide
- Capturing errors
- Configuration
- Using “context” for events
- Using “breadcrumbs” for events
- How to blacklist sensitive data tracking (GDPR, security)