From 33345a9f511c16924902c09fbb22d28422871757 Mon Sep 17 00:00:00 2001 From: Randall Stillwell Date: Mon, 21 Jul 2025 15:56:26 -0500 Subject: [PATCH] Fix Vercel deployment issues - Update Node.js version from 18.x to 22.x for Neon compatibility - Fix TypeScript errors by properly typing error objects as Error - Resolve engine compatibility issues with @neondatabase/serverless and react-router - Add proper error type casting in all API endpoints - Fix FUNCTION_INVOCATION_FAILED crashes --- api/migrate.ts | 4 ++-- api/v1/cards/[id].ts | 2 +- api/v1/cards/index.ts | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/migrate.ts b/api/migrate.ts index 521094b..da38ad7 100644 --- a/api/migrate.ts +++ b/api/migrate.ts @@ -118,7 +118,7 @@ export default async function handler(req: NextRequest) { `; migratedCount++; } catch (error) { - const errorMsg = `Error migrating card ${card.name}: ${error.message}`; + const errorMsg = `Error migrating card ${card.name}: ${(error as Error).message}`; console.error(errorMsg); errors.push(errorMsg); } @@ -146,7 +146,7 @@ export default async function handler(req: NextRequest) { return new NextResponse(JSON.stringify({ success: false, error: 'Migration failed', - details: error.message + details: (error as Error).message }), { status: 500, headers: { 'Content-Type': 'application/json' }, diff --git a/api/v1/cards/[id].ts b/api/v1/cards/[id].ts index d711945..7327d3e 100644 --- a/api/v1/cards/[id].ts +++ b/api/v1/cards/[id].ts @@ -102,7 +102,7 @@ export default async function handler(req: NextRequest) { console.error('API Error:', error) return new NextResponse(JSON.stringify({ error: 'Internal server error', - details: process.env.NODE_ENV === 'development' ? error.message : undefined + details: process.env.NODE_ENV === 'development' ? (error as Error).message : undefined }), { status: 500, headers: { diff --git a/api/v1/cards/index.ts b/api/v1/cards/index.ts index 1f2bb22..e87e256 100644 --- a/api/v1/cards/index.ts +++ b/api/v1/cards/index.ts @@ -110,7 +110,7 @@ export default async function handler(req: NextRequest) { console.error('API Error:', error) return new NextResponse(JSON.stringify({ error: 'Internal server error', - details: process.env.NODE_ENV === 'development' ? error.message : undefined + details: process.env.NODE_ENV === 'development' ? (error as Error).message : undefined }), { status: 500, headers: { diff --git a/package-lock.json b/package-lock.json index f982119..e3ff349 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,7 @@ "tailwindcss": "^3.4.17" }, "engines": { - "node": "18.x" + "node": "22.x" } }, "node_modules/@adobe/css-tools": { diff --git a/package.json b/package.json index 6a30d3d..98ca388 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "engines": { - "node": "18.x" + "node": "22.x" }, "dependencies": { "@neondatabase/serverless": "^1.0.1",