Skip to content

Commit a61f041

Browse files
committed
🥅 Catch verifWebhook error
1 parent 5c120f2 commit a61f041

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/models/controller.model.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,8 +1407,22 @@ export class Controller {
14071407
throw new ServerError(501, 'Webhook verification not implemented');
14081408
}
14091409

1410-
const verified = await this.adapter.verifyWebhookRequest(req);
1410+
let verified: boolean;
1411+
1412+
try {
1413+
verified = await this.adapter.verifyWebhookRequest(req);
1414+
} catch (error) {
1415+
errorLogger(
1416+
'handleWebhook',
1417+
'Error while verifying webhook request:',
1418+
'',
1419+
error || 'Unknown',
1420+
);
1421+
throw new ServerError(403, 'Webhook verification failed');
1422+
}
1423+
14111424
if (!verified) {
1425+
errorLogger('handleWebhook', 'Webhook verification failed', '');
14121426
throw new ServerError(403, 'Webhook verification failed');
14131427
}
14141428

0 commit comments

Comments
 (0)