mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
chore: Upgrade Sentry to latest and update debug messages (#9134)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
parent
77dc055d81
commit
f12b92ce9d
7 changed files with 116 additions and 110 deletions
|
@ -27,8 +27,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@excalidraw/random-username": "1.0.0",
|
||||
"@sentry/browser": "6.2.5",
|
||||
"@sentry/integrations": "6.2.5",
|
||||
"@sentry/browser": "9.0.1",
|
||||
"callsites": "4.2.0",
|
||||
"firebase": "8.3.3",
|
||||
"i18next-browser-languagedetector": "6.1.4",
|
||||
"idb-keyval": "6.0.3",
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import * as Sentry from "@sentry/browser";
|
||||
import * as SentryIntegrations from "@sentry/integrations";
|
||||
import callsites from "callsites";
|
||||
|
||||
const SentryEnvHostnameMap: { [key: string]: string } = {
|
||||
"excalidraw.com": "production",
|
||||
"staging.excalidraw.com": "staging",
|
||||
"vercel.app": "staging",
|
||||
};
|
||||
|
||||
|
@ -24,11 +25,12 @@ Sentry.init({
|
|||
ignoreErrors: [
|
||||
"undefined is not an object (evaluating 'window.__pad.performLoop')", // Only happens on Safari, but spams our servers. Doesn't break anything
|
||||
"InvalidStateError: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.", // Not much we can do about the IndexedDB closing error
|
||||
/TypeError: Failed to fetch dynamically imported module: https:\/\/excalidraw\.com\/assets\/index\.esm.*/i, // This is happening when a service worker tries to load an old asset
|
||||
/TypeError: error loading dynamically imported module: https:\/\/excalidraw\.com\/assets\/index\.esm.*/i, // This is happening when a service worker tries to load an old asset
|
||||
/(Failed to fetch|(fetch|loading) dynamically imported module)/i, // This is happening when a service worker tries to load an old asset
|
||||
/QuotaExceededError: (The quota has been exceeded|.*setItem.*Storage)/i, // localStorage quota exceeded
|
||||
"Internal error opening backing store for indexedDB.open", // Private mode and disabled indexedDB
|
||||
],
|
||||
integrations: [
|
||||
new SentryIntegrations.CaptureConsole({
|
||||
Sentry.captureConsoleIntegration({
|
||||
levels: ["error"],
|
||||
}),
|
||||
],
|
||||
|
@ -36,6 +38,44 @@ Sentry.init({
|
|||
if (event.request?.url) {
|
||||
event.request.url = event.request.url.replace(/#.*$/, "");
|
||||
}
|
||||
|
||||
if (!event.exception) {
|
||||
event.exception = {
|
||||
values: [
|
||||
{
|
||||
type: "ConsoleError",
|
||||
value: event.message ?? "Unknown error",
|
||||
stacktrace: {
|
||||
frames: callsites()
|
||||
.slice(1)
|
||||
.filter(
|
||||
(frame) =>
|
||||
frame.getFileName() &&
|
||||
!frame.getFileName()?.includes("@sentry_browser.js"),
|
||||
)
|
||||
.map((frame) => ({
|
||||
filename: frame.getFileName() ?? undefined,
|
||||
function: frame.getFunctionName() ?? undefined,
|
||||
in_app: !(
|
||||
frame.getFileName()?.includes("node_modules") ?? false
|
||||
),
|
||||
lineno: frame.getLineNumber() ?? undefined,
|
||||
colno: frame.getColumnNumber() ?? undefined,
|
||||
})),
|
||||
},
|
||||
mechanism: {
|
||||
type: "instrument",
|
||||
handled: true,
|
||||
data: {
|
||||
function: "console.error",
|
||||
handler: "Sentry.beforeSend",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
return event;
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue