Lead fehler
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { db } from '@/lib/db';
|
||||
import { Prisma } from '@prisma/client';
|
||||
|
||||
interface LeadInput {
|
||||
email: string;
|
||||
@@ -37,6 +38,20 @@ export async function POST(request: Request) {
|
||||
return NextResponse.json({ success: true, id: lead.id });
|
||||
} catch (error) {
|
||||
console.error('Error saving lead:', error);
|
||||
|
||||
if (error instanceof Prisma.PrismaClientKnownRequestError) {
|
||||
if (error.code === 'P2021') {
|
||||
console.error('CRITICAL: Table "Lead" does not exist in the database. Run "npx prisma migrate deploy" to fix this.');
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: 'Database configuration error',
|
||||
details: 'Missing database table. Please run migrations.'
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the actual error message for debugging purposes
|
||||
return NextResponse.json(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user