Skip to content

Commit d3b03a2

Browse files
committed
Move Sentry config to instrumentation-client.ts
1 parent ea3c702 commit d3b03a2

File tree

2 files changed

+105
-97
lines changed

2 files changed

+105
-97
lines changed

apps/dashboard/sentry.client.config.ts

Lines changed: 0 additions & 97 deletions
This file was deleted.

apps/dashboard/src/instrumentation-client.ts

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
import * as Sentry from "@sentry/nextjs";
12
// eslint-disable-next-line no-restricted-imports
23
import posthog from "posthog-js";
34

5+
// ------------------------------------------------------------
6+
// POSTHOG
7+
// ------------------------------------------------------------
8+
49
const NEXT_PUBLIC_POSTHOG_KEY = process.env.NEXT_PUBLIC_POSTHOG_KEY;
510

611
if (NEXT_PUBLIC_POSTHOG_KEY) {
@@ -16,3 +21,103 @@ if (NEXT_PUBLIC_POSTHOG_KEY) {
1621
ui_host: "https://us.posthog.com",
1722
});
1823
}
24+
25+
// ------------------------------------------------------------
26+
// SENTRY
27+
// ------------------------------------------------------------
28+
29+
Sentry.init({
30+
allowUrls: [/thirdweb-dev\.com/i, /thirdweb\.com/, /thirdweb-preview\.com/],
31+
32+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
33+
debug: false,
34+
denyUrls: [
35+
// Google Adsense
36+
/pagead\/js/i,
37+
// Facebook flakiness
38+
/graph\.facebook\.com/i,
39+
// Facebook blocked
40+
/connect\.facebook\.net\/en_US\/all\.js/i,
41+
// Woopra flakiness
42+
/eatdifferent\.com\.woopra-ns\.com/i,
43+
/static\.woopra\.com\/js\/woopra\.js/i,
44+
// Chrome extensions
45+
/extensions\//i,
46+
/^chrome:\/\//i,
47+
// Other plugins
48+
// Cacaoweb
49+
/127\.0\.0\.1:4001\/isrunning/i,
50+
/webappstoolbarba\.texthelp\.com\//i,
51+
/metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
52+
// injected (extensions)
53+
/inject/i,
54+
],
55+
dsn: "https://[email protected]/6690186",
56+
ignoreErrors: [
57+
// Random plugins/extensions
58+
"top.GLOBALS",
59+
// See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error.html
60+
"originalCreateNotification",
61+
"canvas.contentDocument",
62+
"MyApp_RemoveAllHighlights",
63+
"http://tt.epicplay.com",
64+
"Can't find variable: ZiteReader",
65+
"jigsaw is not defined",
66+
"ComboSearch is not defined",
67+
"http://loading.retry.widdit.com/",
68+
"atomicFindClose",
69+
// Facebook borked
70+
"fb_xd_fragment",
71+
// ISP "optimizing" proxy - `Cache-Control: no-transform` seems to reduce this. (thanks @acdha)
72+
// See http://stackoverflow.com/questions/4113268/how-to-stop-javascript-injection-from-vodafone-proxy
73+
"bmi_SafeAddOnload",
74+
"EBCallBackMessageReceived",
75+
// See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx
76+
"conduitPage",
77+
// Avast extension error
78+
"_avast_submit",
79+
// Common non-actionable errors
80+
"rejected transaction",
81+
"User closed modal",
82+
"Loading chunk",
83+
"Failed to execute '",
84+
"NetworkError when attempting to fetch resource.",
85+
"googlefc is not defined",
86+
"__cmp is not defined",
87+
"Cannot read properties of undefined (reading 'cmp')",
88+
"Cannot read properties of undefined (reading 'outputCurrentConfiguration')",
89+
"apstagLOADED is not defined",
90+
"moat_px is not defined",
91+
"window.ReactNativeWebView.postMessage is not a function",
92+
"_reportEvent is not defined",
93+
"requestAnimationFrame is not defined",
94+
"window.requestAnimationFrame is not a function",
95+
"tronLink.setAddress is not a function",
96+
// benign errors
97+
"ResizeObserver loop limit exceeded",
98+
// cannot do anything with these errors
99+
"Non-Error promise rejection captured",
100+
],
101+
102+
// You can remove this option if you're not planning to use the Sentry Session Replay feature:
103+
integrations: [
104+
Sentry.replayIntegration({
105+
blockAllMedia: true,
106+
// Additional Replay configuration goes in here, for example:
107+
maskAllText: true,
108+
}),
109+
],
110+
111+
replaysOnErrorSampleRate: 1.0,
112+
113+
// This sets the sample rate to be 10%. You may want this to be 100% while
114+
// in development and sample at a lower rate in production
115+
replaysSessionSampleRate: 0.1,
116+
117+
// Adjust this value in production, or use tracesSampler for greater control
118+
tracesSampleRate: 0.1,
119+
});
120+
121+
// This export will instrument router navigations, and is only relevant if you enable tracing.
122+
// `captureRouterTransitionStart` is available from SDK version 9.12.0 onwards
123+
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;

0 commit comments

Comments
 (0)