Skip to content

Commit 53b0970

Browse files
fix: resolve all build errors for Vercel deployment
- Remove unused MCP server API routes (no longer needed) - Remove /auth/callback/page.tsx (route conflict with route.ts) - Wrap useSearchParams in Suspense boundary (Next.js 15 requirement) - Add Organization export to cost-optimizer types - Fix async cookies() calls for Supabase server client - Simplify vercel.json configuration Build passes with only deprecation warnings (metadata viewport). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b762e2a commit 53b0970

20 files changed

Lines changed: 150 additions & 501 deletions

File tree

public/sw.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/agents/CodeArchitect.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ export class CodeArchitect extends BaseAgent {
4040
fileStructure,
4141
estimatedComplexity: complexity.level,
4242
estimatedTime: complexity.time,
43-
estimatedCost: complexity.cost
43+
estimatedCost: complexity.cost,
44+
summary: architecture.summary || '',
45+
stack: architecture.stack || { frontend: [], backend: [], database: [] },
46+
deploymentStrategy: architecture.deploymentStrategy || { platform: 'vercel', environment: 'serverless', cicd: true }
4447
}
4548

4649
// Store in context (will be saved to state)

src/app/api/auth/github/route.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { createClient } from '@/lib/supabase/server'
22
import { NextResponse } from 'next/server'
3-
import { cookies } from 'next/headers'
43

54
export async function POST(request: Request) {
6-
const cookieStore = cookies()
7-
const supabase = createClient(cookieStore)
5+
const supabase = await createClient()
86

97
const { data, error } = await supabase.auth.signInWithOAuth({
108
provider: 'github',

src/app/api/chat/route.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export interface ChatResponse {
2929
// Allow dependency injection for testing
3030
let costOptimizerInstance: CostOptimizerClient | null = null;
3131

32-
export function setCostOptimizer(client: CostOptimizerClient | null) {
32+
// Internal helper for testing - not exported from this route file
33+
// Tests should import from a separate utilities file if needed
34+
function setCostOptimizer(client: CostOptimizerClient | null) {
3335
costOptimizerInstance = client;
3436
}
3537

src/app/api/github/pr/route.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { createClient } from '@/lib/supabase/server'
22
import { GitHubPRService } from '@/services/github/pr.service'
33
import { NextRequest, NextResponse } from 'next/server'
4-
import { cookies } from 'next/headers'
54

65
export async function POST(request: NextRequest) {
76
try {
8-
const cookieStore = cookies()
9-
const supabase = createClient(cookieStore)
7+
const supabase = await createClient()
108

119
// Get current user session
1210
const { data: { session }, error: sessionError } = await supabase.auth.getSession()

src/app/api/github/repos/route.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { createClient } from '@/lib/supabase/server'
22
import { GitHubClient } from '@/lib/github/client'
33
import { NextResponse } from 'next/server'
4-
import { cookies } from 'next/headers'
54

65
export async function GET(request: Request) {
7-
const cookieStore = cookies()
8-
const supabase = createClient(cookieStore)
6+
const supabase = await createClient()
97

108
// Get current user session
119
const { data: { session }, error: sessionError } = await supabase.auth.getSession()

src/app/api/mcp/health/route.ts

Lines changed: 0 additions & 106 deletions
This file was deleted.

src/app/api/mcp/unified/route.ts

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/app/api/models/route.ts

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,27 @@ import { NextRequest, NextResponse } from 'next/server'
22
import HuggingFaceDiscoveryService from '@/services/huggingface/discovery.service'
33
import RunPodDeploymentService from '@/services/runpod/deployment.service'
44

5-
// Initialize services
6-
let hfService: HuggingFaceDiscoveryService;
7-
let runpodService: RunPodDeploymentService;
5+
// Lazy initialize services - only create when needed, not at module load time
6+
let hfService: HuggingFaceDiscoveryService | null = null;
7+
let runpodService: RunPodDeploymentService | null = null;
88

9-
try {
10-
hfService = new HuggingFaceDiscoveryService();
11-
runpodService = new RunPodDeploymentService();
12-
} catch (error) {
13-
console.error('Failed to initialize services:', error);
9+
function getHFService(): HuggingFaceDiscoveryService {
10+
if (!hfService) {
11+
hfService = new HuggingFaceDiscoveryService();
12+
}
13+
return hfService;
14+
}
15+
16+
function getRunPodService(): RunPodDeploymentService | null {
17+
try {
18+
if (!runpodService && process.env.RUNPOD_API_KEY) {
19+
runpodService = new RunPodDeploymentService();
20+
}
21+
return runpodService;
22+
} catch (error) {
23+
console.warn('RunPod service not available:', error instanceof Error ? error.message : 'Unknown error');
24+
return null;
25+
}
1426
}
1527

1628
export async function GET(request: NextRequest) {
@@ -22,13 +34,9 @@ export async function GET(request: NextRequest) {
2234
const offset = parseInt(searchParams.get('offset') || '0')
2335
const sortBy = searchParams.get('sortBy') || 'downloads'
2436

25-
// Check if services are initialized
26-
if (!hfService) {
27-
throw new Error('HuggingFace service not initialized. Check HUGGINGFACE_TOKEN env variable.');
28-
}
29-
30-
// Use real HuggingFace discovery service
31-
const searchResult = await hfService.searchModels({
37+
// Get services lazily
38+
const hf = getHFService();
39+
const searchResult = await hf.searchModels({
3240
search,
3341
task: task === 'all' ? 'text-generation' : task,
3442
sort: sortBy as 'downloads' | 'likes' | 'updated',

0 commit comments

Comments
 (0)