diff --git a/src/app/api/webhook/route.js b/src/app/api/webhook/route.js index 54659ca..5f564cb 100644 --- a/src/app/api/webhook/route.js +++ b/src/app/api/webhook/route.js @@ -13,17 +13,18 @@ async function connectDB() { const CLERK_WEBHOOK_SECRET = process.env.CLERK_WEBHOOK_SECRET; -if (!CLERK_WEBHOOK_SECRET) { - console.error('CLERK_WEBHOOK_SECRET is missing'); - return NextResponse.json( - { message: 'Internal server error: Secret missing' }, - { status: 500 } - ); -} export async function POST(req) { console.log('Received request:', req); + if (!CLERK_WEBHOOK_SECRET) { + console.error('CLERK_WEBHOOK_SECRET is missing'); + return NextResponse.json( + { message: 'Internal server error: Secret missing' }, + { status: 500 } + ); + } + if (req.method !== 'POST') { return NextResponse.json( { message: 'Method Not Allowed' },