apps/web (@sentry/nextjs): - sentry.client.config.ts / sentry.server.config.ts / sentry.edge.config.ts initialize Sentry only when NEXT_PUBLIC_SENTRY_DSN (or SENTRY_DSN on the server) is set; tracesSampleRate 0.1 - next.config.mjs wraps the existing config with withSentryConfig only when a DSN is present; source-map upload stays disabled until SENTRY_AUTH_TOKEN is provided - .env.example documents NEXT_PUBLIC_SENTRY_DSN and the optional auth token apps/api (@sentry/node): - src/lib/sentry.ts initializes Sentry at module load when SENTRY_DSN is set - server.ts imports sentry.ts as the very first side-effect so early-boot errors (env validation, plugin registration) reach Sentry - env schema gains optional SENTRY_DSN (URL) - app.ts registers an errorHandler that captures the exception with the authenticated user when SENTRY_DSN is set; logs and re-sends as before Build-time housekeeping: - profile route: targetDate ?? null on create to satisfy Prisma's input shape under exactOptionalPropertyTypes - profile form: useForm receives defaultValues only when initial is provided (spread instead of `defaultValues: undefined`); Field error prop typed `string | undefined` for exactOptionalPropertyTypes Without a DSN both apps run unchanged (Sentry is inert). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
import { withSentryConfig } from '@sentry/nextjs';
|
|
import createNextIntlPlugin from 'next-intl/plugin';
|
|
|
|
const withNextIntl = createNextIntlPlugin('./src/i18n.ts');
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
reactStrictMode: true,
|
|
transpilePackages: ['@ketopath/auth', '@ketopath/db', '@ketopath/shared', '@ketopath/ui'],
|
|
experimental: {
|
|
typedRoutes: true,
|
|
},
|
|
webpack(config) {
|
|
// I package interni usano .js nelle import (NodeNext). Webpack non lo
|
|
// risolve di default per i file TS: gli diciamo di provare anche .ts/.tsx.
|
|
config.resolve.extensionAlias = {
|
|
...config.resolve.extensionAlias,
|
|
'.js': ['.ts', '.tsx', '.js', '.jsx'],
|
|
};
|
|
return config;
|
|
},
|
|
};
|
|
|
|
const isSentryEnabled = Boolean(process.env.NEXT_PUBLIC_SENTRY_DSN);
|
|
|
|
const sentryWebpackPluginOptions = {
|
|
silent: true,
|
|
org: process.env.SENTRY_ORG,
|
|
project: process.env.SENTRY_PROJECT,
|
|
// Source map upload requires SENTRY_AUTH_TOKEN — disabled until configured.
|
|
disableServerWebpackPlugin: !process.env.SENTRY_AUTH_TOKEN,
|
|
disableClientWebpackPlugin: !process.env.SENTRY_AUTH_TOKEN,
|
|
};
|
|
|
|
const composed = withNextIntl(nextConfig);
|
|
|
|
export default isSentryEnabled ? withSentryConfig(composed, sentryWebpackPluginOptions) : composed;
|