@@ -2,9 +2,16 @@ import { createClient } from '@supabase/supabase-js'
22import { NextRequest , NextResponse } from 'next/server'
33import { z } from 'zod'
44
5- const supabaseUrl = process . env . NEXT_PUBLIC_SUPABASE_URL !
6- const supabaseServiceRoleKey = process . env . SUPABASE_SERVICE_ROLE_KEY !
5+ const supabaseUrl = process . env . NEXT_PUBLIC_SUPABASE_URL ;
6+ const supabaseServiceRoleKey = process . env . SUPABASE_SERVICE_ROLE_KEY ;
77
8+ if ( ! supabaseUrl ) {
9+ throw new Error ( "CRITICAL: NEXT_PUBLIC_SUPABASE_URL environment variable is not defined." ) ;
10+ }
11+
12+ if ( ! supabaseServiceRoleKey ) {
13+ throw new Error ( "CRITICAL: SUPABASE_SERVICE_ROLE_KEY environment variable is not defined." ) ;
14+ }
815const supabase = createClient ( supabaseUrl , supabaseServiceRoleKey )
916
1017const createProjectSchema = z . object ( {
@@ -14,12 +21,6 @@ const createProjectSchema = z.object({
1421 template : z . string ( ) . optional ( ) ,
1522} )
1623
17- const updateProjectSchema = z . object ( {
18- name : z . string ( ) . min ( 1 ) . max ( 50 ) . optional ( ) ,
19- description : z . string ( ) . max ( 200 ) . optional ( ) ,
20- visibility : z . enum ( [ 'private' , 'public' ] ) . optional ( ) ,
21- template : z . string ( ) . optional ( ) ,
22- } )
2324
2425async function getUserFromAuth ( request : NextRequest ) {
2526 const authHeader = request . headers . get ( 'authorization' )
0 commit comments