fix: invalid request body (#1686)
Fix the invalid request body so the webhooks work again.
This commit is contained in:
@@ -21,14 +21,16 @@ export const handlerTriggerWebhooks = async (req: Request) => {
|
|||||||
return Response.json({ success: false, error: 'Missing signature' }, { status: 400 });
|
return Response.json({ success: false, error: 'Missing signature' }, { status: 400 });
|
||||||
}
|
}
|
||||||
|
|
||||||
const valid = verify(req.body, signature);
|
const body = await req.json();
|
||||||
|
|
||||||
|
const valid = verify(body, signature);
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
console.log('Invalid signature');
|
console.log('Invalid signature');
|
||||||
return Response.json({ success: false, error: 'Invalid signature' }, { status: 400 });
|
return Response.json({ success: false, error: 'Invalid signature' }, { status: 400 });
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = ZTriggerWebhookBodySchema.safeParse(req.body);
|
const result = ZTriggerWebhookBodySchema.safeParse(body);
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
console.log('Invalid request body');
|
console.log('Invalid request body');
|
||||||
|
|||||||
Reference in New Issue
Block a user