Skip to content

Commit ff88aa5

Browse files
apex-ai-netclaude
andcommitted
fix(build): resolve Netlify deployment failures
- Add explicit Node.js runtime exports to 4 API routes - Move TypeScript from dependencies to devDependencies (-9.1MB Lambda) - Exclude TypeScript from Lambda bundle in next.config.ts - Update @netlify/plugin-nextjs to v5.13.5 These changes resolve: 1. API routes defaulting to Edge runtime causing failures 2. TypeScript compiler bundled in Lambda (9.1MB waste) 3. Plugin version mismatch with Next.js 15.5.4 Expected impact: - Lambda bundle size: 86MB → ~77MB (10% reduction) - Proper runtime configuration for OpenAI/Stripe SDKs - Improved build reliability 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5830a6a commit ff88aa5

7 files changed

Lines changed: 27 additions & 72 deletions

File tree

app/api/create-checkout/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { logger } from '@/lib/logger';
77
import type { ConvexUserDoc } from '@/lib/supabase/convex-compat';
88
import { getStripePriceId } from '@/lib/stripe/pricing-config';
99

10+
// Specify Node.js runtime (required for Stripe SDK and Supabase)
11+
export const runtime = 'nodejs';
12+
1013
/**
1114
* Plan ID validation schema
1215
*/

app/api/gpt5/documentation/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import { validateHealthcarePrompt } from "@/lib/prompts";
99
import { docsRateLimiter, checkRateLimit } from "@/lib/rate-limit";
1010
import { logger } from "@/lib/logger";
1111

12+
// Specify Node.js runtime (required for OpenAI SDK)
13+
export const runtime = 'nodejs';
14+
1215
let cachedOpenAI: OpenAI | null = null;
1316
function getOpenAIClient(): OpenAI | null {
1417
const apiKey = process.env.OPENAI_API_KEY;

app/api/gpt5/function/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import { validateHealthcarePrompt } from "@/lib/prompts";
99
import { fnRateLimiter, checkRateLimit } from "@/lib/rate-limit";
1010
import { logger } from "@/lib/logger";
1111

12+
// Specify Node.js runtime (required for OpenAI SDK)
13+
export const runtime = 'nodejs';
14+
1215
let cachedOpenAI: OpenAI | null = null;
1316

1417
function getOpenAIClient(): OpenAI | null {

app/api/gpt5/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import { getUserTier, checkTieredRateLimit } from "@/lib/rate-limit";
1111
import { getSupabaseServerClient } from "@/lib/supabase/client";
1212
import { getCurrentStudent } from "@/lib/supabase/services/students";
1313

14+
// Specify Node.js runtime (required for OpenAI SDK)
15+
export const runtime = 'nodejs';
16+
1417
let cachedOpenAI: OpenAI | null = null;
1518
function getOpenAIClient(): OpenAI | null {
1619
const apiKey = process.env.OPENAI_API_KEY;

next.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ const nextConfig: NextConfig = {
168168
'node_modules/webpack/**',
169169
'node_modules/terser/**',
170170
'node_modules/rollup/**',
171+
// TypeScript compiler (build-time only, not needed in Lambda)
172+
'node_modules/typescript/**',
171173
// Testing dependencies (not needed in production)
172174
'node_modules/playwright-core',
173175
'node_modules/@playwright',

0 commit comments

Comments
 (0)