mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2026-02-01 04:24:32 +01:00
fix sentry double init
This commit is contained in:
committed by
Tony Giorgio
parent
f5c0a830d9
commit
1379b4a6d9
@@ -12,7 +12,8 @@ import {
|
||||
LargeHeader,
|
||||
Logs,
|
||||
NiceP,
|
||||
SmallHeader
|
||||
SmallHeader,
|
||||
ToggleReportDiagnostics
|
||||
} from "~/components";
|
||||
import { useI18n } from "~/i18n/context";
|
||||
import {
|
||||
@@ -221,6 +222,7 @@ export function SetupErrorDisplay(props: {
|
||||
</ExternalLink>
|
||||
</NiceP>
|
||||
<ImportExport emergency />
|
||||
<ToggleReportDiagnostics />
|
||||
<Logs />
|
||||
<div class="flex flex-col gap-2 rounded-xl bg-m-red p-4">
|
||||
<SmallHeader>
|
||||
|
||||
@@ -4,7 +4,6 @@ import { createMemo, createSignal, Show } from "solid-js";
|
||||
import {
|
||||
BackLink,
|
||||
Button,
|
||||
ButtonLink,
|
||||
DefaultMain,
|
||||
InfoBox,
|
||||
LargeHeader,
|
||||
@@ -162,9 +161,6 @@ export function Encrypt() {
|
||||
</Button>
|
||||
</VStack>
|
||||
</Form>
|
||||
<ButtonLink href="/" intent="green">
|
||||
{i18n.t("settings.encrypt.skip")}
|
||||
</ButtonLink>
|
||||
</VStack>
|
||||
</DefaultMain>
|
||||
<NavBar activeTab="settings" />
|
||||
|
||||
@@ -177,36 +177,41 @@ export const makeMegaStoreContext = () => {
|
||||
const reportDiagnostics =
|
||||
localStorage.getItem("report_diagnostics") === "true";
|
||||
|
||||
if (reportDiagnostics && sentryenv !== "") {
|
||||
Sentry.init({
|
||||
dsn: "https://192c556849619517322719962a057376@sen.mutinywallet.com/2",
|
||||
environment: sentryenv,
|
||||
release: "mutiny-web@" + RELEASE_VERSION,
|
||||
integrations: [
|
||||
Sentry.browserTracingIntegration(),
|
||||
Sentry.replayIntegration()
|
||||
],
|
||||
try {
|
||||
// If there's a password that means we've already setup sentry the first time
|
||||
if (reportDiagnostics && sentryenv !== "" && !password) {
|
||||
Sentry.init({
|
||||
dsn: "https://192c556849619517322719962a057376@sen.mutinywallet.com/2",
|
||||
environment: sentryenv,
|
||||
release: "mutiny-web@" + RELEASE_VERSION,
|
||||
integrations: [
|
||||
Sentry.browserTracingIntegration(),
|
||||
Sentry.replayIntegration()
|
||||
],
|
||||
|
||||
initialScope: {
|
||||
tags: { component: "main" }
|
||||
},
|
||||
initialScope: {
|
||||
tags: { component: "main" }
|
||||
},
|
||||
|
||||
// Set tracesSampleRate to 1.0 to capture 100%
|
||||
// of transactions for performance monitoring.
|
||||
// We recommend adjusting this value in production
|
||||
tracesSampleRate: 1.0,
|
||||
// Set tracesSampleRate to 1.0 to capture 100%
|
||||
// of transactions for performance monitoring.
|
||||
// We recommend adjusting this value in production
|
||||
tracesSampleRate: 1.0,
|
||||
|
||||
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
|
||||
tracePropagationTargets: [
|
||||
"localhost",
|
||||
/^https:\/\/mutinywallet\.com/
|
||||
],
|
||||
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
|
||||
tracePropagationTargets: [
|
||||
"localhost",
|
||||
/^https:\/\/mutinywallet\.com/
|
||||
],
|
||||
|
||||
// Capture Replay for 10% of all sessions,
|
||||
// plus 100% of sessions with an error
|
||||
replaysSessionSampleRate: 0.1,
|
||||
replaysOnErrorSampleRate: 1.0
|
||||
});
|
||||
// Capture Replay for 10% of all sessions,
|
||||
// plus 100% of sessions with an error
|
||||
replaysSessionSampleRate: 0.1,
|
||||
replaysOnErrorSampleRate: 1.0
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error initializing sentry", e);
|
||||
}
|
||||
|
||||
// handle lsp settings
|
||||
|
||||
@@ -102,52 +102,63 @@ export async function setupMutinyWallet(
|
||||
nsec?: string
|
||||
): Promise<boolean> {
|
||||
// initialize both inside worker and outside
|
||||
if (reportDiagnostics && sentryenv !== "") {
|
||||
Sentry.init({
|
||||
dsn: "https://192c556849619517322719962a057376@sen.mutinywallet.com/2",
|
||||
environment: sentryenv,
|
||||
release: "mutiny-web@" + RELEASE_VERSION,
|
||||
integrations: [
|
||||
Sentry.captureConsoleIntegration(), // grab all mutiny-node console lines
|
||||
Sentry.browserTracingIntegration(),
|
||||
Sentry.replayIntegration()
|
||||
],
|
||||
try {
|
||||
if (reportDiagnostics && sentryenv !== "") {
|
||||
Sentry.init({
|
||||
dsn: "https://192c556849619517322719962a057376@sen.mutinywallet.com/2",
|
||||
environment: sentryenv,
|
||||
release: "mutiny-web@" + RELEASE_VERSION,
|
||||
integrations: [
|
||||
Sentry.captureConsoleIntegration(), // grab all mutiny-node console lines
|
||||
Sentry.browserTracingIntegration(),
|
||||
Sentry.replayIntegration()
|
||||
],
|
||||
|
||||
initialScope: {
|
||||
tags: { component: "worker" }
|
||||
},
|
||||
initialScope: {
|
||||
tags: { component: "worker" }
|
||||
},
|
||||
|
||||
// ignore any hex larger than 20 char
|
||||
ignoreErrors: [/(?:[0-9a-fA-F]{20,}\b)+/],
|
||||
// ignore any hex larger than 20 char
|
||||
ignoreErrors: [/(?:[0-9a-fA-F]{20,}\b)+/],
|
||||
|
||||
// only do a new issue for errors w/ or w/o exceptions, and warnings
|
||||
beforeSend(event, hint) {
|
||||
const error = hint.originalException;
|
||||
if (error && typeof error === "object" && "message" in error) {
|
||||
return event;
|
||||
} else if (event.level == "warning" || event.level == "error") {
|
||||
return event;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
// only do a new issue for errors w/ or w/o exceptions, and warnings
|
||||
beforeSend(event, hint) {
|
||||
const error = hint.originalException;
|
||||
if (
|
||||
error &&
|
||||
typeof error === "object" &&
|
||||
"message" in error
|
||||
) {
|
||||
return event;
|
||||
} else if (
|
||||
event.level == "warning" ||
|
||||
event.level == "error"
|
||||
) {
|
||||
return event;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
// Set tracesSampleRate to 1.0 to capture 100%
|
||||
// of transactions for performance monitoring.
|
||||
// We recommend adjusting this value in production
|
||||
tracesSampleRate: 1.0,
|
||||
// Set tracesSampleRate to 1.0 to capture 100%
|
||||
// of transactions for performance monitoring.
|
||||
// We recommend adjusting this value in production
|
||||
tracesSampleRate: 1.0,
|
||||
|
||||
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
|
||||
tracePropagationTargets: [
|
||||
"localhost",
|
||||
/^https:\/\/mutinywallet\.com/
|
||||
],
|
||||
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
|
||||
tracePropagationTargets: [
|
||||
"localhost",
|
||||
/^https:\/\/mutinywallet\.com/
|
||||
],
|
||||
|
||||
// Capture Replay for 10% of all sessions,
|
||||
// plus 100% of sessions with an error
|
||||
replaysSessionSampleRate: 0.1,
|
||||
replaysOnErrorSampleRate: 1.0
|
||||
});
|
||||
// Capture Replay for 10% of all sessions,
|
||||
// plus 100% of sessions with an error
|
||||
replaysSessionSampleRate: 0.1,
|
||||
replaysOnErrorSampleRate: 1.0
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error initializing sentry", e);
|
||||
}
|
||||
|
||||
console.log("Starting setup...");
|
||||
|
||||
Reference in New Issue
Block a user