feat: Upgrade to Next.js 16.1 & React 19.2, migrate to Supabase SSR with async client handling
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
|
||||
import { geminiModel, SYSTEM_INSTRUCTION } from '@/lib/gemini';
|
||||
import { BottleMetadataSchema, AnalysisResponse } from '@/types/whisky';
|
||||
import { createServerActionClient } from '@supabase/auth-helpers-nextjs';
|
||||
import { cookies } from 'next/headers';
|
||||
import { createClient } from '@/lib/supabase/server';
|
||||
import { createHash } from 'crypto';
|
||||
import { trackApiUsage } from './track-api-usage';
|
||||
import { checkCreditBalance, deductCredits } from './credit-service';
|
||||
@@ -16,7 +15,7 @@ export async function analyzeBottle(base64Image: string, tags?: string[], locale
|
||||
let supabase; // Declare supabase outside try block for error tracking access
|
||||
try {
|
||||
// Initialize Supabase client inside the try block
|
||||
supabase = createServerActionClient({ cookies });
|
||||
supabase = await createClient();
|
||||
console.log('[analyzeBottle] Initialized Supabase client');
|
||||
|
||||
// ... (auth and credit check remain same) ...
|
||||
|
||||
Reference in New Issue
Block a user