diff --git a/next.config.js b/next.config.js index 9a36fe29b34dae..00f62a79b442bd 100644 --- a/next.config.js +++ b/next.config.js @@ -23,6 +23,15 @@ const outputFileTracingExcludes = process.env.NEXT_PUBLIC_DEVELOPER_DOCS 'sitemap.xml': ['docs/**/*', 'public/mdx-images/**/*', '*.gif', '*.pdf', '*.png'], }; +if ( + process.env.NODE_ENV !== 'development' && + (!process.env.NEXT_PUBLIC_SENTRY_DSN || !process.env.SENTRY_DSN) +) { + throw new Error( + 'Missing required environment variables: NEXT_PUBLIC_SENTRY_DSN and SENTRY_DSN must be set in production' + ); +} + /** @type {import('next').NextConfig} */ const nextConfig = { pageExtensions: ['js', 'jsx', 'mdx', 'ts', 'tsx'],