From 3de1701175cee1feb7b400384fa49d44dc2c1622 Mon Sep 17 00:00:00 2001 From: jknapp Date: Fri, 15 May 2026 08:10:47 -0700 Subject: [PATCH] fix(env): coerce empty EMBEDDER_URL to undefined Zod's .url().optional() still rejects "" because the empty string is a present value. EMBEDDER_URL is unused in Phase 1 and intentionally left blank in .env, so preprocess "" to undefined before validation. Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/web/lib/env.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/web/lib/env.ts b/apps/web/lib/env.ts index beed0b2..d9c5fa3 100644 --- a/apps/web/lib/env.ts +++ b/apps/web/lib/env.ts @@ -22,7 +22,8 @@ const envSchema = z.object({ DATABASE_URL: z.string().url(), // Embedder (used in Phase 2; present-but-empty allowed in Phase 1) - EMBEDDER_URL: z.string().url().optional(), + EMBEDDER_URL: z + .preprocess((v) => (v === "" ? undefined : v), z.string().url().optional()), EMBEDDING_MODEL: z.string().default("Xenova/bge-small-en-v1.5"), EMBEDDING_DIM: z.coerce.number().int().positive().default(384),