How to receive console.log in terminal in development? Only console.logs to Vercel Logs...
Unanswered
Nebelung posted this in #help-forum
NebelungOP
Hey all,
I'm not sure how to read console logs from /api/webhooks/route locally in my terminal... I'm getting the
}
return new Response(JSON.stringify({ received: true }));
}
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 }));
}