Files
zitadel/apps/login/next.config.mjs
T
Max PeintnerandGitHub adaa6a8de6 fix(login): integration tests failing due to React 19 SSR errors (#10613)
# Which Problems Are Solved

Integration tests were failing with Minified React error 419 caused by
React 19 Suspense boundary issues during server-side rendering (SSR) to
client-side rendering (CSR) transitions.

# How the Problems Are Solved

The fix handles infrastructure-level SSR errors gracefully while
maintaining proper error detection for actual application issues.

- Added Cypress error handling for React 19 SSR hydration errors that
don't affect functionality

# Additional Changes

Enhanced Next.js configuration with React 19 compatibility
optimizations:
- `optimizePackageImports`: @radix-ui/react-tooltip and @heroicons/react
can have large bundle sizes if not optimized. Such packages are
suggested to be optimized in
https://nextjs.org/docs/app/api-reference/config/next-config-js/optimizePackageImports
- `poweredByHeader`: Not that important. Benefits are smaller HTTP
headers, Tiny bandwidth savings, and more professional appearance due to
cleaner response headers, added it as a "security best practice".


# Additional Context

- Replaces #10611
2025-09-01 16:16:18 +02:00

69 lines
1.5 KiB
JavaScript
Executable File

import createNextIntlPlugin from "next-intl/plugin";
import { DEFAULT_CSP } from "./constants/csp.js";
const withNextIntl = createNextIntlPlugin();
/** @type {import('next').NextConfig} */
const secureHeaders = [
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
},
{
key: "Referrer-Policy",
value: "origin-when-cross-origin",
},
{
key: "X-Frame-Options",
value: "SAMEORIGIN",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "X-XSS-Protection",
value: "1; mode=block",
},
{
key: "Content-Security-Policy",
value: `${DEFAULT_CSP} frame-ancestors 'none'`,
},
{ key: "X-Frame-Options", value: "deny" },
];
const nextConfig = {
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
output: process.env.NEXT_OUTPUT_MODE || undefined,
reactStrictMode: true,
experimental: {
dynamicIO: true,
// Add React 19 compatibility optimizations
optimizePackageImports: ['@radix-ui/react-tooltip', '@heroicons/react'],
},
images: {
unoptimized: true
},
eslint: {
ignoreDuringBuilds: true,
},
// Improve SSR stability - not actually needed for React 19 SSR issues
// onDemandEntries: {
// maxInactiveAge: 25 * 1000,
// pagesBufferLength: 2,
// },
// Better error handling for production builds
poweredByHeader: false,
async headers() {
return [
{
source: "/:path*",
headers: secureHeaders,
},
];
},
};
export default withNextIntl(nextConfig);