From db2a3e2ffa5cc0083cd3dcad97bff1b06cbd203c Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Thu, 19 Mar 2026 09:37:55 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20nx-ignore=20command=20on?= =?UTF-8?q?=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 15 ++------------- apps/builder/next.config.mjs | 30 ++++++++++++++++++------------ apps/viewer/next.config.mjs | 30 ++++++++++++++++++------------ 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9ab433a47..93d7c0893 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,19 +25,8 @@ WORKDIR /app FROM base AS builder ARG SCOPE COPY . . -RUN SKIP_ENV_CHECK=true \ - DATABASE_URL=postgresql:// \ - ENCRYPTION_SECRET=12345678901234567890123456789012 \ - NEXTAUTH_URL=http://localhost:3000 \ - NEXT_PUBLIC_VIEWER_URL=http://localhost:3001 \ - SENTRYCLI_SKIP_DOWNLOAD=1 \ - bun install --frozen-lockfile -RUN SKIP_ENV_CHECK=true \ - DATABASE_URL=postgresql:// \ - ENCRYPTION_SECRET=12345678901234567890123456789012 \ - NEXTAUTH_URL=http://localhost:3000 \ - NEXT_PUBLIC_VIEWER_URL=http://localhost:3001 \ - bunx nx build ${SCOPE} +RUN SENTRYCLI_SKIP_DOWNLOAD=1 bun install --frozen-lockfile +RUN SKIP_ENV_CHECK=true NEXT_PUBLIC_VIEWER_URL=http://localhost bunx nx build ${SCOPE} RUN DATABASE_URL=postgresql:// bunx nx db:generate prisma # ================== RELEASE ====================== diff --git a/apps/builder/next.config.mjs b/apps/builder/next.config.mjs index c823b2090..f610a89d3 100644 --- a/apps/builder/next.config.mjs +++ b/apps/builder/next.config.mjs @@ -1,7 +1,6 @@ import { dirname, join } from "node:path"; -import { withSentryConfig } from "@sentry/nextjs"; -import "@typebot.io/env/compiled"; import { fileURLToPath } from "node:url"; +import { withSentryConfig } from "@sentry/nextjs"; import { configureRuntimeEnv } from "next-runtime-env/build/configure.js"; const __filename = fileURLToPath(import.meta.url); @@ -93,13 +92,20 @@ const nextConfig = { }, }; -export default process.env.SENTRY_DSN - ? withSentryConfig(nextConfig, { - org: process.env.SENTRY_ORG, - project: process.env.SENTRY_PROJECT, - authToken: process.env.SENTRY_AUTH_TOKEN, - widenClientFileUpload: true, - // Only print logs for uploading source maps in CI - silent: !process.env.CI, - }) - : nextConfig; +export default async function config() { + // Avoid loading env package when NX is creating the graph (nx-ignore command) + if (global.NX_GRAPH_CREATION) return nextConfig; + + await import("@typebot.io/env/compiled"); + + return process.env.SENTRY_DSN + ? withSentryConfig(nextConfig, { + org: process.env.SENTRY_ORG, + project: process.env.SENTRY_PROJECT, + authToken: process.env.SENTRY_AUTH_TOKEN, + widenClientFileUpload: true, + // Only print logs for uploading source maps in CI + silent: !process.env.CI, + }) + : nextConfig; +} diff --git a/apps/viewer/next.config.mjs b/apps/viewer/next.config.mjs index efce6a600..603d3a63a 100644 --- a/apps/viewer/next.config.mjs +++ b/apps/viewer/next.config.mjs @@ -1,7 +1,6 @@ import { dirname, join } from "node:path"; -import { withSentryConfig } from "@sentry/nextjs"; -import "@typebot.io/env/compiled"; import { fileURLToPath } from "node:url"; +import { withSentryConfig } from "@sentry/nextjs"; import { configureRuntimeEnv } from "next-runtime-env/build/configure.js"; const __filename = fileURLToPath(import.meta.url); @@ -154,13 +153,20 @@ const nextConfig = { }, }; -export default process.env.SENTRY_DSN && process.env.SENTRY_AUTH_TOKEN - ? withSentryConfig(nextConfig, { - org: process.env.SENTRY_ORG, - project: process.env.SENTRY_PROJECT, - authToken: process.env.SENTRY_AUTH_TOKEN, - widenClientFileUpload: true, - // Only print logs for uploading source maps in CI - silent: !process.env.CI, - }) - : nextConfig; +export default async function config() { + // Avoid loading env package when NX is creating the graph (nx-ignore command) + if (global.NX_GRAPH_CREATION) return nextConfig; + + await import("@typebot.io/env/compiled"); + + return process.env.SENTRY_DSN + ? withSentryConfig(nextConfig, { + org: process.env.SENTRY_ORG, + project: process.env.SENTRY_PROJECT, + authToken: process.env.SENTRY_AUTH_TOKEN, + widenClientFileUpload: true, + // Only print logs for uploading source maps in CI + silent: !process.env.CI, + }) + : nextConfig; +}