@@ -2,26 +2,37 @@ import client from '@plone/volto/start-client';
2
2
3
3
client ( ) ;
4
4
5
- // Add Sentry SSR test function for development
5
+ // Add Sentry SSR test function (works in both dev and prod)
6
6
if ( typeof window !== 'undefined' ) {
7
- window . testSentrySSR = ( ) => {
8
- console . log ( '🧪 Testing Sentry SSR error capture from frontend...' ) ;
7
+ // Wait a bit for everything to load, then make function available
8
+ setTimeout ( ( ) => {
9
+ window . testSentrySSR = ( ) => {
10
+ console . log ( '🧪 Testing Sentry SSR error capture from frontend...' ) ;
11
+
12
+ // Simulate SSR-like errors that should be captured
13
+ console . error ( 'Error: Service Unavailable - Frontend test for SSR error capture' ) ;
14
+ console . error ( ' at Request.callback (/app/node_modules/superagent/lib/node/index.js:696:15)' ) ;
15
+
16
+ console . error ( 'TypeError: Cannot read properties of undefined (reading \'test\')' ) ;
17
+ console . error ( ' at /app/build/server.js:1:3722480' ) ;
18
+
19
+ console . error ( 'Error: connect EHOSTUNREACH 10.62.64.90:8080 - Test SSR network error' ) ;
20
+
21
+ console . error ( 'This error originated either by throwing inside of an async function without a catch block - Test SSR async error' ) ;
22
+
23
+ console . log ( '🧪 Test SSR errors logged to console - check Sentry dashboard' ) ;
24
+
25
+ // Also try to trigger a direct Sentry capture if available
26
+ if ( window . Sentry ) {
27
+ window . Sentry . captureMessage ( 'Direct frontend Sentry test - SSR integration check 🧪' , 'info' ) ;
28
+ console . log ( '✅ Direct Sentry message sent' ) ;
29
+ } else {
30
+ console . log ( 'ℹ️ Sentry not available on window object' ) ;
31
+ }
32
+ } ;
9
33
10
- // Simulate SSR-like errors that should be captured
11
- console . error ( 'Error: Service Unavailable - Frontend test for SSR error capture' ) ;
12
- console . error ( ' at Request.callback (/app/node_modules/superagent/lib/node/index.js:696:15)' ) ;
13
-
14
- console . error ( 'TypeError: Cannot read properties of undefined (reading \'test\')' ) ;
15
- console . error ( ' at /app/build/server.js:1:3722480' ) ;
16
-
17
- console . error ( 'Error: connect EHOSTUNREACH 10.62.64.90:8080 - Test SSR network error' ) ;
18
-
19
- console . error ( 'This error originated either by throwing inside of an async function without a catch block - Test SSR async error' ) ;
20
-
21
- console . log ( '🧪 Test SSR errors logged to console - check Sentry dashboard' ) ;
22
- } ;
23
-
24
- console . log ( '🧪 Sentry SSR test function available: run testSentrySSR() in console' ) ;
34
+ console . log ( '🧪 Sentry SSR test function ready: run testSentrySSR() in console' ) ;
35
+ } , 3000 ) ; // Wait 3 seconds for everything to load
25
36
}
26
37
27
38
if ( module . hot ) {
0 commit comments