fix exception when receiving webhook with no type (#213)

This commit is contained in:
Dave Horton
2023-08-03 19:34:38 -04:00
committed by GitHub
parent d361f1aeb1
commit de7b74f898

View File

@@ -61,8 +61,7 @@ router.post('/', express.raw({type: 'application/json'}), async(req, res) => {
}
/* process event */
logger.info(`received webhook: ${evt.type}`);
if (evt.type.startsWith('invoice.')) handleInvoiceEvents(logger, evt);
if (evt?.type?.startsWith('invoice.')) handleInvoiceEvents(logger, evt);
else {
logger.debug(evt, 'unhandled stripe webook');
}