Improve errors and description of the Zod object responsible for parsing the Supabase keys.
This commit is contained in:
@@ -6,8 +6,16 @@ import { z } from 'zod';
|
|||||||
export function getSupabaseClientKeys() {
|
export function getSupabaseClientKeys() {
|
||||||
return z
|
return z
|
||||||
.object({
|
.object({
|
||||||
url: z.string().min(1),
|
url: z.string({
|
||||||
anonKey: z.string().min(1),
|
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({
|
.parse({
|
||||||
url: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
url: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
||||||
|
|||||||
Reference in New Issue
Block a user