1234567891011121314151617181920212223242526272829303132333435363738 |
- import * as Sentry from "@sentry/browser";
- import * as SentryIntegrations from "@sentry/integrations";
- const SentryEnvHostnameMap: { [key: string]: string } = {
- "excalidraw.com": "production",
- "vercel.app": "staging",
- };
- const SENTRY_DISABLED = import.meta.env.VITE_APP_DISABLE_SENTRY === "true";
- // Disable Sentry locally or inside the Docker to avoid noise/respect privacy
- const onlineEnv =
- !SENTRY_DISABLED &&
- Object.keys(SentryEnvHostnameMap).find(
- (item) => window.location.hostname.indexOf(item) >= 0,
- );
- Sentry.init({
- dsn: onlineEnv
- ? "https://[email protected]/5179260"
- : undefined,
- environment: onlineEnv ? SentryEnvHostnameMap[onlineEnv] : undefined,
- release: import.meta.env.VITE_APP_GIT_SHA,
- ignoreErrors: [
- "undefined is not an object (evaluating 'window.__pad.performLoop')", // Only happens on Safari, but spams our servers. Doesn't break anything
- ],
- integrations: [
- new SentryIntegrations.CaptureConsole({
- levels: ["error"],
- }),
- ],
- beforeSend(event) {
- if (event.request?.url) {
- event.request.url = event.request.url.replace(/#.*$/, "");
- }
- return event;
- },
- });
|