From 1c23b6d4edf7e034426513e83f9ff2a2237831ca Mon Sep 17 00:00:00 2001 From: d-ivashchuk Date: Sun, 24 Mar 2024 19:19:39 +0100 Subject: [PATCH] another one --- src/env.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/env.js b/src/env.js index 7eb0db7..47a912b 100644 --- a/src/env.js +++ b/src/env.js @@ -24,13 +24,16 @@ export const env = createEnv({ process.env.NODE_ENV === "production" ? z.string() : z.string().optional(), - NEXTAUTH_URL: z.preprocess( - // This makes Vercel deployments not fail if you don't set NEXTAUTH_URL - // Since NextAuth.js automatically uses the VERCEL_URL if present. - (str) => process.env.VERCEL_URL ?? str, - // VERCEL_URL doesn't include `https` so it cant be validated as a URL - process.env.VERCEL ? z.string() : z.string().url(), - ), + NEXTAUTH_URL: + process.env.NODE_ENV === "production" + ? z.preprocess( + // This makes Vercel deployments not fail if you don't set NEXTAUTH_URL + // Since NextAuth.js automatically uses the VERCEL_URL if present. + (str) => process.env.VERCEL_URL ?? str, + // VERCEL_URL doesn't include `https` so it cant be validated as a URL + process.env.VERCEL ? z.string() : z.string().url(), + ) + : z.string().optional(), DISCORD_CLIENT_ID: process.env.NODE_ENV === "production" ? z.string()