Skip to content

Commit

Permalink
fix exception when receiving webhook with no type (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
davehorton authored Aug 3, 2023
1 parent d361f1a commit de7b74f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/routes/stripe/webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit de7b74f

Please sign in to comment.