klg-asutk-app/sentry.server.config.ts
Yuriy 0150aba4f5 Consolidation: KLG ASUTK + PAPA integration
- Unify API: lib/api.ts uses /api/v1, inbox uses /api/inbox (rewrites)
- Remove localhost refs: openapi, inbox page
- Add rewrites: /api/inbox|tmc -> inbox-server, /api/v1 -> FastAPI
- Add stub routes: knowledge/insights, recommendations, search, log-error
- Transfer from PAPA: prompts (inspection, tmc), scripts, supabase, data/tmc-requests
- Fix inbox-server: ORDER BY created_at, package.json
- Remove redundant app/api/inbox/files route (rewrites handle it)
- knowledge/ in gitignore (large PDFs)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 17:18:31 +03:00

36 lines
1.3 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Конфигурация Sentry для серверной стороны
*/
import * as Sentry from '@sentry/nextjs';
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
environment: process.env.NODE_ENV || 'development',
tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 1.0,
debug: process.env.NODE_ENV === 'development',
beforeSend(event, _hint) {
// Фильтрация чувствительных данных
if (event.request?.data) {
const data = event.request.data as any;
if (data.password) delete data.password;
if (data.token) delete data.token;
if (data.apiKey) delete data.apiKey;
}
return event;
},
});
// Инициализация мониторинга необработанных Promise rejections
if (typeof process !== 'undefined') {
try {
// Динамический импорт для избежания проблем с SSR
import('@/lib/monitoring/unhandled-rejections').then((module) => {
module.initUnhandledRejectionMonitoring();
}).catch(() => {
// Игнорируем ошибки при инициализации (может быть вызвано на клиенте)
});
} catch {
// Игнорируем ошибки
}
}