Skip to content

Commit d34e1ca

Browse files
authored
Merge pull request #40 from eea/develop
Develop
2 parents d2efea2 + 329cca0 commit d34e1ca

File tree

5 files changed

+70
-19
lines changed

5 files changed

+70
-19
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
### [0.38.0](https://github.com/eea/ied-frontend/compare/0.37.0...0.38.0) - 17 September 2025
8+
9+
#### :hammer_and_wrench: Others
10+
11+
- test ssr [Dobricean Ioan Dorian - [`f087b67`](https://github.com/eea/ied-frontend/commit/f087b679850cb0d4361a9c1c6511ef61e4bdffe6)]
712
### [0.37.0](https://github.com/eea/ied-frontend/compare/0.36.0...0.37.0) - 17 September 2025
813

914
#### :hammer_and_wrench: Others

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "ied-frontend",
33
"description": "",
44
"license": "MIT",
5-
"version": "0.37.0",
5+
"version": "0.38.0",
66
"scripts": {
77
"start": "razzle start",
88
"postinstall": "make omelette && make patches",

src/client.js

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,37 @@ import client from '@plone/volto/start-client';
22

33
client();
44

5-
// Add Sentry SSR test function for development
5+
// Add Sentry SSR test function (works in both dev and prod)
66
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+
};
933

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
2536
}
2637

2738
if (module.hot) {

src/config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,18 @@
1212
// [Internal] All the imports of modules required for the configuration *must* happen
1313
// here BEFORE the following line
1414
import '@plone/volto/config';
15+
import SSRCrash from './views/SSRCrash';
1516

1617
export default function applyConfig(config) {
18+
// Add SSR crash test route for Sentry testing
19+
config.addonRoutes = [
20+
...(config.addonRoutes || []),
21+
{
22+
path: '/_crash-ssr',
23+
component: SSRCrash,
24+
exact: true,
25+
},
26+
];
27+
1728
return config;
1829
}

src/views/SSRCrash.jsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react';
2+
3+
/**
4+
* Test view that deliberately crashes during SSR to test Sentry error capture
5+
* Only crashes on server-side rendering, works fine on client
6+
*/
7+
export default function SSRCrash() {
8+
if (__SERVER__) {
9+
// This will throw during server-side rendering and should be captured by Sentry
10+
throw new Error('SSR crash test: thrown during server-side render - This should appear in Sentry');
11+
}
12+
13+
return (
14+
<div style={{ padding: '20px', textAlign: 'center' }}>
15+
<h1>SSR Test Passed ✅</h1>
16+
<p>This page loaded successfully on the client side.</p>
17+
<p>If you see this, it means the SSR error was handled properly.</p>
18+
<div style={{ marginTop: '20px', padding: '10px', backgroundColor: '#f0f8ff', border: '1px solid #ccc' }}>
19+
<strong>Note:</strong> This page deliberately throws an error during server-side rendering
20+
to test Sentry SSR error capture. Check your Sentry dashboard for the captured error.
21+
</div>
22+
</div>
23+
);
24+
}

0 commit comments

Comments
 (0)