From 2f2e7d8c85a30e7fa882d63ed5fdf673b0172eeb Mon Sep 17 00:00:00 2001 From: Wisley Date: Fri, 24 Nov 2023 09:51:51 -0300 Subject: [PATCH] fix(webhook ecom): Update debug errors --- functions/lib/galaxpay/update-subscription.js | 7 ++++++- functions/routes/ecom/webhook.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/functions/lib/galaxpay/update-subscription.js b/functions/lib/galaxpay/update-subscription.js index 3c202ed..8e7b8b9 100644 --- a/functions/lib/galaxpay/update-subscription.js +++ b/functions/lib/galaxpay/update-subscription.js @@ -258,7 +258,12 @@ const getSubscriptionsByListMyIds = async ( }, []) return galaxPaySubscriptions } catch (err) { - console.error(err) + if (err.response) { + const { status, data } = err.response + console.log('Error: ', status, ' ', data && JSON.stringify(data)) + } else { + console.error(err) + } return null } } diff --git a/functions/routes/ecom/webhook.js b/functions/routes/ecom/webhook.js index 3dc8c82..bf133fc 100644 --- a/functions/routes/ecom/webhook.js +++ b/functions/routes/ecom/webhook.js @@ -373,7 +373,7 @@ exports.post = async ({ appSdk, admin }, req, res) => { } catch (err) { console.error(`Error trying to update signature #${subscription.myId}`) if (err.response) { - const { status, data } = error.response + const { status, data } = err.response console.log('Error: ', status, ' ', data && JSON.stringify(data)) } error = err