From 60a69e31efc7168b8f4309daf75954d7730d883b Mon Sep 17 00:00:00 2001 From: ajnart <49837342+ajnart@users.noreply.github.com> Date: Mon, 29 Jun 2026 15:13:08 +0200 Subject: [PATCH] fix: revert production source maps to restore v1.67.0 memory baseline CodeRabbit review addressed: - Removed the env-var gating (simpler: just remove source maps entirely) - CI health check now fails fast if container never becomes healthy Changes vs origin/main: - next.config.ts: remove productionBrowserSourceMaps and serverSourceMaps (they default to false, restoring pre-v1.68.0 behavior) - Dockerfile: remove .map copy step and NODE_OPTIONS=--enable-source-maps - CI: add memory-regression job (<700MB guardrail) Closes #6123 --- .github/workflows/code-quality.yml | 7 +++++++ Dockerfile | 16 ---------------- apps/nextjs/next.config.ts | 2 -- scripts/run.sh | 6 ------ 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 7822e89a0..98a247460 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -188,13 +188,20 @@ jobs: run: | docker run -d --name homarr-mem-test -p 17575:7575 homarr-memory-test # Wait for container to be healthy (up to 60s) + healthy=false for i in $(seq 1 30); do if curl -sf http://localhost:17575/api/health 2>/dev/null; then echo "Container healthy after $((i * 2))s" + healthy=true break fi sleep 2 done + if [ "$healthy" != "true" ]; then + echo "ERROR: Container never became healthy" + docker logs homarr-mem-test --tail 50 + exit 1 + fi # Warm up: hit the dashboard page a few times for i in $(seq 1 5); do curl -sf http://localhost:17575/ > /dev/null 2>&1 || true diff --git a/Dockerfile b/Dockerfile index 288dee4f8..9c4d41de8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,19 +20,6 @@ ARG DISABLE_REDIS_LOGS='true' RUN corepack enable pnpm && pnpm build -# Copy server chunk source maps into standalone output when enabled. -# Off by default to avoid the significant memory overhead of --enable-source-maps in Node.js. -# See https://github.com/homarr-labs/homarr/issues/6123 and https://github.com/nodejs/node/issues/46140 -ARG ENABLE_SOURCE_MAPS=false -RUN if [ "$ENABLE_SOURCE_MAPS" = "true" ]; then \ - cd apps/nextjs/.next/server && \ - find . -name '*.map' | while IFS= read -r map; do \ - dest="../standalone/apps/nextjs/.next/server/$map"; \ - mkdir -p "$(dirname "$dest")"; \ - cp "$map" "$dest"; \ - done; \ - fi - FROM base AS runner WORKDIR /app @@ -77,9 +64,6 @@ ENV DB_DRIVER='better-sqlite3' ENV AUTH_PROVIDERS='credentials' ENV REDIS_IS_EXTERNAL='false' ENV NODE_ENV='production' -# Pass through the source maps toggle so run.sh can conditionally set NODE_OPTIONS. -ARG ENABLE_SOURCE_MAPS=false -ENV HOMARR_ENABLE_SOURCE_MAPS=$ENABLE_SOURCE_MAPS ENTRYPOINT [ "/app/entrypoint.sh" ] CMD ["sh", "run.sh"] diff --git a/apps/nextjs/next.config.ts b/apps/nextjs/next.config.ts index a050ecb80..636df3f52 100644 --- a/apps/nextjs/next.config.ts +++ b/apps/nextjs/next.config.ts @@ -31,7 +31,6 @@ const nextConfig: NextConfig = { }, output: "standalone", reactStrictMode: true, - productionBrowserSourceMaps: process.env.HOMARR_ENABLE_SOURCE_MAPS === "true", // react compiler breaks mantine-react-table, so disabled for now //reactCompiler: true, /** We already do typechecking as separate tasks in CI */ @@ -42,7 +41,6 @@ const nextConfig: NextConfig = { */ serverExternalPackages: ["dockerode", "isomorphic-dompurify", "jsdom", "better-sqlite3"], experimental: { - serverSourceMaps: process.env.HOMARR_ENABLE_SOURCE_MAPS === "true", optimizePackageImports: ["@mantine/core", "@mantine/hooks", "@tabler/icons-react"], turbopackFileSystemCacheForDev: true, preloadEntriesOnStart: false, diff --git a/scripts/run.sh b/scripts/run.sh index 817c86018..83eff588e 100644 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -58,12 +58,6 @@ terminate() { trap terminate TERM INT -# Enable source maps in Node.js when explicitly opted in. -# Default off — see https://github.com/homarr-labs/homarr/issues/6123 -if [ "${HOMARR_ENABLE_SOURCE_MAPS}" = "true" ]; then - export NODE_OPTIONS="--enable-source-maps${NODE_OPTIONS:+ $NODE_OPTIONS}" -fi - node apps/nextjs/server.js & NEXTJS_PID=$!