1+ import * as Sentry from "@sentry/nextjs" ;
12// eslint-disable-next-line no-restricted-imports
23import posthog from "posthog-js" ;
34
5+ // ------------------------------------------------------------
6+ // POSTHOG
7+ // ------------------------------------------------------------
8+
49const NEXT_PUBLIC_POSTHOG_KEY = process . env . NEXT_PUBLIC_POSTHOG_KEY ;
510
611if ( 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 : [ / t h i r d w e b - d e v \. c o m / i, / t h i r d w e b \. c o m / , / t h i r d w e b - p r e v i e w \. c o m / ] ,
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+ / p a g e a d \/ j s / i,
37+ // Facebook flakiness
38+ / g r a p h \. f a c e b o o k \. c o m / i,
39+ // Facebook blocked
40+ / c o n n e c t \. f a c e b o o k \. n e t \/ e n _ U S \/ a l l \. j s / i,
41+ // Woopra flakiness
42+ / e a t d i f f e r e n t \. c o m \. w o o p r a - n s \. c o m / i,
43+ / s t a t i c \. w o o p r a \. c o m \/ j s \/ w o o p r a \. j s / i,
44+ // Chrome extensions
45+ / e x t e n s i o n s \/ / i,
46+ / ^ c h r o m e : \/ \/ / i,
47+ // Other plugins
48+ // Cacaoweb
49+ / 1 2 7 \. 0 \. 0 \. 1 : 4 0 0 1 \/ i s r u n n i n g / i,
50+ / w e b a p p s t o o l b a r b a \. t e x t h e l p \. c o m \/ / i,
51+ / m e t r i c s \. i t u n e s \. a p p l e \. c o m \. e d g e s u i t e \. n e t \/ / i,
52+ // injected (extensions)
53+ / i n j e c t / i,
54+ ] ,
55+ dsn : "https://8813f5d93c8c4aa89eda86816f0b1bbf@o1378374.ingest.sentry.io/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