Aggregator2.0
Aggregator2.0
PPrisma
Created by Aggregator2.0 on 5/9/2025 in #help-and-questions
Vercel Build Failing with Prisma + Supabase + Next.js API Routes
Hey, I'm deploying a backend-only Next.js project using API routes (no frontend) with Prisma (connected to Supabase), and everytime there's build failures on Vercel. Everything works locally, but Vercel throws errors like: - @prisma/client has no exported member 'PrismaClient' Cannot find module 'express' npm run build exited with code 1 I’ve already tried:npx prisma generate works, Installed all needed deps (@prisma/client, prisma, typescript, etc.), Set CI=false in Vercel env vars, Cleaned project structure and removed old Express files. Still getting the build error. Any idea what I might be missing? Here’s what I’ve got: schema.prisma
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

model orders {
id Int @id @default(autoincrement())
product String
quantity Int
createdAt DateTime @default(now())
}
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

model orders {
id Int @id @default(autoincrement())
product String
quantity Int
createdAt DateTime @default(now())
}
lib/prisma.ts
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
export default prisma;
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
export default prisma;
pages/api/orders.ts
import prisma from '../../lib/prisma';

export default async function handler(req, res) {
const newOrder = await prisma.orders.create({
data: {
product: 'Apple',
quantity: 5
}
});
res.status(200).json(newOrder);
}
import prisma from '../../lib/prisma';

export default async function handler(req, res) {
const newOrder = await prisma.orders.create({
data: {
product: 'Apple',
quantity: 5
}
});
res.status(200).json(newOrder);
}
.env
DATABASE_URL="postgresql://user:pass@host:5432/db"
DATABASE_URL="postgresql://user:pass@host:5432/db"
tsconfig.json
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["pages", "lib"],
"exclude": ["node_modules"]
}
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["pages", "lib"],
"exclude": ["node_modules"]
}
5 replies