Next.js Discord

Discord Forum

How to receive console.log in terminal in development? Only console.logs to Vercel Logs...

Unanswered
Nebelung posted this in #help-forum
Open in Discord
NebelungOP
Hey all,
I'm not sure how to read console logs from /api/webhooks/route locally in my terminal... I'm getting the πŸ”” Webhook received: ${event.type} in the Vercel Logs.
`` export async function POST(req: Request) { const body = await req.text(); const sig = req.headers.get('stripe-signature') as string; const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET; let event: Stripe.Event; console.log('Webhook endpoint hit'); try { if (!sig || !webhookSecret) return new Response('Webhook secret not found.', { status: 400 }); event = stripe.webhooks.constructEvent(body, sig, webhookSecret); console.log(πŸ”” Webhook received: ${event.type}); } catch (err: any) { console.log(❌ Error message: ${err.message}); return new Response(Webhook Error: ${err.message}`, { status: 400 });
}

return new Response(JSON.stringify({ received: true }));
}

0 Replies