From 00e0c9d205b46123041322de0c39ef4d3ee56493 Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Wed, 8 Sep 2021 12:27:09 +0200 Subject: [PATCH] Fixed webhook handler check for if Stripe configured no-issue Previously we would not create an instance of the StripeAPIService if Stripe was not configured, but that is not the case any more, instead we have a configured flag on the service. The webhook route handler was not updated to use this flag and so would attempt to handle webhooks without having any of the required data. This would result in an uncaught error. --- ghost/members-api/lib/MembersAPI.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghost/members-api/lib/MembersAPI.js b/ghost/members-api/lib/MembersAPI.js index 093e363d61..bec5a4cb7f 100644 --- a/ghost/members-api/lib/MembersAPI.js +++ b/ghost/members-api/lib/MembersAPI.js @@ -350,7 +350,7 @@ module.exports = function MembersAPI({ }; middleware.handleStripeWebhook.use(body.raw({type: 'application/json'}), async function (req, res) { - if (!stripeAPIService) { + if (!stripeAPIService.configured) { common.logging.error(`Stripe not configured, not handling webhook`); res.writeHead(400); return res.end();