Fix vercel build

This commit is contained in:
Fergal Moran
2023-07-07 19:40:33 +01:00
parent 1568bffd17
commit 6022dcaa27

View File

@@ -11,13 +11,7 @@ export const env = createEnv({
process.env.NODE_ENV === "production"
? z.string().min(1)
: z.string().min(1).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().min(1) : z.string().url()
),
NEXTAUTH_URL: z.string().url(),
JWT_SECRET: z.string(),
// Add `.min(1) on ID and SECRET if you want to make sure they're not empty
GOOGLE_CLIENT_ID: z.string(),