You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The server-nestjs container crashes at startup (~5.5s, declared unhealthy → a process crash, not a healthcheck timeout), which aborts the Playwright E2E job before any spec runs.
Root cause: apps/server-nestjs/src/config/base.config.ts (added by commit 29563dd "configuration to nestjs system") declares PROJECTS_ROOT_DIR as z.string().min(1) with no default. The CI Docker env template .env.docker-example does not set it, and nothing injects it. At boot, main.ts calls app.get(BASE_CONFIG) → baseConfigFactory() → zod throws "PROJECTS_ROOT_DIR: Required" → app.listen never runs → process exits → container unhealthy → compose aborts.
Note: the consumed interface (apps/server-nestjs/src/modules/infrastructure/config/base.config.ts:18) already declares projectsRootDir?: string — optional. The zod schema was stricter than its own contract.
This is the 3rd CI breakage from the same configuration → module-definition migration:
This: container startup crash (Playwright job 90233026446, run 30345985676)
Expected vs actual
Expected: container boots and passes healthcheck when PROJECTS_ROOT_DIR is unset (it is optional in the consumed interface; gitlab/argocd vault path generation only needs it when those features run).
Actual: process exits immediately with ZodError: PROJECTS_ROOT_DIR: Required.
Failure timeline: Started 09:24:43.835 → Error 09:24:49.362 (~5.5s, crash not timeout)
Root-cause commit: 29563dd87e
Node >= 24, pnpm v11.8
Reproduction
cp apps/server-nestjs/.env.docker-example apps/server-nestjs/.env.docker (leave PROJECTS_ROOT_DIR unset — it is absent from the template).
Boot the server-nestjs service via pnpm docker:dev.
Container exits unhealthy; logs show ZodError: PROJECTS_ROOT_DIR: Required.
Minimal unit repro:
import{baseConfigFactory}from"./config/base.config";deleteprocess.env.PROJECTS_ROOT_DIR;baseConfigFactory();// throws before fix, returns { projectsRootDir: "" } after fix
Fix (already applied on branch wt/t_7c23f271)
PROJECTS_ROOT_DIR was made optional in base.config.ts and gitlab.config.ts (the two registerAs-based zod schemas that require it), defaulting to "" in the transform. A regression spec src/config/base.config.spec.ts asserts the factory no longer throws when the var is unset (passes locally).
Follow-up / hardening
Audit every config registerAs schema for required env vars that are absent from the corresponding .env*docker/integ*-example templates before the next config-migration lands (close the pattern, not just this instance).
Add a CI guard: a smoke task that boots server-nestjs against the committed example env files and fails on non-zero exit, so a missing-env crash surfaces in the build stage rather than the E2E stage.
Consider a shared zod helper for "optional path env with safe default" to keep schemas consistent with their consumed interfaces.
Summary
The
server-nestjscontainer crashes at startup (~5.5s, declared unhealthy → a process crash, not a healthcheck timeout), which aborts the Playwright E2E job before any spec runs.Root cause:
apps/server-nestjs/src/config/base.config.ts(added by commit 29563dd "configuration to nestjs system") declaresPROJECTS_ROOT_DIRasz.string().min(1)with no default. The CI Docker env template.env.docker-exampledoes not set it, and nothing injects it. At boot,main.tscallsapp.get(BASE_CONFIG)→baseConfigFactory()→zodthrows"PROJECTS_ROOT_DIR: Required"→app.listennever runs → process exits → container unhealthy → compose aborts.Note: the consumed interface (
apps/server-nestjs/src/modules/infrastructure/config/base.config.ts:18) already declaresprojectsRootDir?: string— optional. The zod schema was stricter than its own contract.This is the 3rd CI breakage from the same configuration → module-definition migration:
TS2304) — open90233026446, run30345985676)Expected vs actual
PROJECTS_ROOT_DIRis unset (it is optional in the consumed interface; gitlab/argocd vault path generation only needs it when those features run).ZodError: PROJECTS_ROOT_DIR: Required.Environment
apps/server-nestjs(NestJS rewrite)playwright-tests/test90233026446)29563dd87eReproduction
cp apps/server-nestjs/.env.docker-example apps/server-nestjs/.env.docker(leavePROJECTS_ROOT_DIRunset — it is absent from the template).server-nestjsservice viapnpm docker:dev.ZodError: PROJECTS_ROOT_DIR: Required.Minimal unit repro:
Fix (already applied on branch
wt/t_7c23f271)PROJECTS_ROOT_DIRwas made optional inbase.config.tsandgitlab.config.ts(the tworegisterAs-based zod schemas that require it), defaulting to""in the transform. A regression specsrc/config/base.config.spec.tsasserts the factory no longer throws when the var is unset (passes locally).Follow-up / hardening
registerAsschema for required env vars that are absent from the corresponding.env*docker/integ*-example templates before the next config-migration lands (close the pattern, not just this instance).server-nestjsagainst the committed example env files and fails on non-zero exit, so a missing-env crash surfaces in the build stage rather than the E2E stage.