ente/sentry.client.config.js

47 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-06-07 10:45:46 +00:00
import * as Sentry from '@sentry/nextjs';
2022-01-20 06:43:10 +00:00
import { getSentryTunnelURL } from 'utils/common/apiUtil';
2022-07-27 06:14:13 +00:00
import { getSentryUserID } from 'utils/user';
2022-01-07 11:58:05 +00:00
import {
getSentryDSN,
getSentryENV,
getSentryRelease,
getIsSentryEnabled,
} from 'constants/sentry';
2021-07-17 10:21:05 +00:00
2022-01-07 11:58:05 +00:00
const SENTRY_DSN = getSentryDSN();
const SENTRY_ENV = getSentryENV();
const SENTRY_RELEASE = getSentryRelease();
const IS_ENABLED = getIsSentryEnabled();
2021-07-17 10:21:05 +00:00
2021-06-07 10:45:46 +00:00
Sentry.init({
dsn: SENTRY_DSN,
enabled: IS_ENABLED,
2021-06-18 09:29:46 +00:00
environment: SENTRY_ENV,
2022-01-07 11:58:05 +00:00
release: SENTRY_RELEASE,
2021-06-09 14:52:11 +00:00
attachStacktrace: true,
2021-08-16 12:49:27 +00:00
autoSessionTracking: false,
2022-01-20 06:43:10 +00:00
tunnel: getSentryTunnelURL(),
2022-02-04 12:01:40 +00:00
beforeSend(event) {
event.request = event.request || {};
const currentURL = new URL(document.location.href);
currentURL.hash = '';
event.request.url = currentURL;
return event;
},
2022-02-25 08:04:39 +00:00
integrations: function (i) {
return i.filter(function (i) {
return i.name !== 'Breadcrumbs';
});
},
2021-06-07 10:45:46 +00:00
// ...
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
// that it will also get attached to your source maps
});
2022-11-17 09:08:22 +00:00
2022-11-17 09:14:10 +00:00
const main = async () => {
Sentry.setUser({ id: await getSentryUserID() });
};
main();