From f7a5202c5185450b5a52e988031e5cc0dfd5c993 Mon Sep 17 00:00:00 2001 From: gbuomprisco Date: Mon, 13 Jan 2025 02:33:58 +0700 Subject: [PATCH] Improve errors and description of the Zod object responsible for parsing the Supabase keys. --- packages/supabase/src/get-supabase-client-keys.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/supabase/src/get-supabase-client-keys.ts b/packages/supabase/src/get-supabase-client-keys.ts index 22f1cc575..6d8a53129 100644 --- a/packages/supabase/src/get-supabase-client-keys.ts +++ b/packages/supabase/src/get-supabase-client-keys.ts @@ -6,8 +6,16 @@ import { z } from 'zod'; export function getSupabaseClientKeys() { return z .object({ - url: z.string().min(1), - anonKey: z.string().min(1), + url: z.string({ + description: `This is the URL of your hosted Supabase instance. Please provide the variable NEXT_PUBLIC_SUPABASE_URL.`, + required_error: `Please provide the variable NEXT_PUBLIC_SUPABASE_URL`, + }), + anonKey: z + .string({ + description: `This is the anon key provided by Supabase. It is a public key used client-side. Please provide the variable NEXT_PUBLIC_SUPABASE_ANON_KEY.`, + required_error: `Please provide the variable NEXT_PUBLIC_SUPABASE_ANON_KEY`, + }) + .min(1), }) .parse({ url: process.env.NEXT_PUBLIC_SUPABASE_URL,