The basic sentry sdk configuration we use at moccu
$ npm install --save @moccu/sentry-config
The sentry-config exposes an init(...)
function to simply setup sentry with a
given config object. The config object should contain at least a dsn
and a list of strings called whitelistUrls
. The init function adds additional
tasks to the initialization process for the sentry sdk. It converts all
whitelistUrls into regular expressions and adds additional tags
from the
config object into each scope of a sentry reporting.
As second (optional) param you can pass a boolean whether to expose, or not
to expose the Senty
-Object to the global namespace. By default (= true
)
it will be exposed.
The usage may look as follows:
import {init} from '@moccu/sentry-config';
init({
dsn: 'https://<key>@sentry.io/<project>',
whitelistUrls: ['example\\.com'],
release: '1.0.0',
environment: 'live',
attachStacktrace: true,
tags: {
source: 'frontend'
}
}, true);
The sentry-config exposes a preconfigured set of ignoreErrors
and ignoreUrls
.
Usage may look as follows:
import * as Sentry from '@sentry/browser';
import {ignoreErrors, ignoreUrls} from '@moccu/sentry-config';
Sentry.init({
dsn: 'https://<key>@sentry.io/<project>',
whitelistUrls: [/example\.com/],
ignoreErrors,
ignoreUrls
});
// or
import {init} from '@moccu/sentry-config';
init({
dsn: 'https://<key>@sentry.io/<project>',
whitelistUrls: ['example\\.com'],
ignoreErrors,
ignoreUrls
});
All you need to do is to mark your commit as releasable using npm version
- you may want
to take a look at the documentation.
The publishing itself is done by github actions.
$ npm version 1.0.0
If the publishing step fails due to authentication reasons you might need to
create a new NODE_AUTH_TOKEN
(on npm, make sure your'e a member of @moccu)
and set it in the secrets settings of this repository.