From 1933fc4f11572bd10b69781f65f15fc5a00cfb8b Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Wed, 3 Jun 2026 10:21:47 -0700 Subject: [PATCH] fix(env): schema treatment of empty string (#4862) --- apps/realtime/src/env.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/realtime/src/env.ts b/apps/realtime/src/env.ts index 083126a60d..40f5abd898 100644 --- a/apps/realtime/src/env.ts +++ b/apps/realtime/src/env.ts @@ -3,7 +3,10 @@ import { z } from 'zod' const EnvSchema = z.object({ NODE_ENV: z.enum(['development', 'test', 'production']).default('development'), DATABASE_URL: z.string().url(), - REDIS_URL: z.string().url().optional(), + REDIS_URL: z.preprocess( + (value) => (typeof value === 'string' && value.trim() === '' ? undefined : value), + z.string().url().optional() + ), BETTER_AUTH_URL: z.string().url(), BETTER_AUTH_SECRET: z.string().min(32), INTERNAL_API_SECRET: z.string().min(32),