feat: downgrade tech stack to stable versions and integrate GA4 error monitoring
- Downgrade Next.js 16→14.2, React 19→18.3, Tailwind 4→3.4 - Add comprehensive GA4 error monitoring system - Create Jenkins CI/CD pipeline with quality gates - Fix build issues: ESLint, SWC conflict, config format - Add documentation for deployment and error tracking
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import * as Sentry from '@sentry/nextjs';
|
||||
|
||||
const SENTRY_DSN = process.env.SENTRY_DSN || '';
|
||||
|
||||
if (SENTRY_DSN) {
|
||||
Sentry.init({
|
||||
dsn: SENTRY_DSN,
|
||||
environment: process.env.NODE_ENV || 'development',
|
||||
enabled: process.env.NODE_ENV !== 'development',
|
||||
|
||||
tracesSampleRate: 1.0,
|
||||
|
||||
beforeSend(event, hint) {
|
||||
const error = hint.originalException;
|
||||
|
||||
if (error instanceof Error) {
|
||||
event.contexts = {
|
||||
...event.contexts,
|
||||
runtime: {
|
||||
name: 'node',
|
||||
version: process.version,
|
||||
},
|
||||
application: {
|
||||
name: 'novalon-website',
|
||||
version: process.env.npm_package_version || 'unknown',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
if (event.request?.cookies) {
|
||||
delete event.request.cookies['session_id'];
|
||||
delete event.request.cookies['token'];
|
||||
}
|
||||
|
||||
return event;
|
||||
},
|
||||
});
|
||||
|
||||
console.log('[Sentry] Server-side monitoring initialized');
|
||||
} else {
|
||||
console.warn('[Sentry] SENTRY_DSN not configured, server-side error monitoring disabled');
|
||||
}
|
||||
|
||||
export default Sentry;
|
||||
Reference in New Issue
Block a user