From 5a368886d4001aa40f4ae27724ddb3fee1ea3332 Mon Sep 17 00:00:00 2001 From: Wisley Date: Fri, 24 Nov 2023 09:19:44 -0300 Subject: [PATCH] fix(webhook ecom): Update debug errors --- functions/routes/ecom/webhook.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/functions/routes/ecom/webhook.js b/functions/routes/ecom/webhook.js index 1db13d4..fdbbea8 100644 --- a/functions/routes/ecom/webhook.js +++ b/functions/routes/ecom/webhook.js @@ -199,7 +199,11 @@ exports.post = async ({ appSdk, admin }, req, res) => { console.warn(`>> StoreApi webhook: Document does not exist Firestore, order #${resourceId}, not found`) status = 404 } else { - console.error('> Error editing subscription => ', err) + if (response && response.data) { + console.error('> Error editing subscription => ', JSON.stringify(response.data)) + } else { + console.error('> Error editing subscription => ', err) + } } res.status(status).send({ @@ -368,8 +372,9 @@ exports.post = async ({ appSdk, admin }, req, res) => { } } catch (err) { console.error(`Error trying to update signature #${subscription.myId}`) - if (err?.response) { - console.error('Error: ', err?.response, ' <') + if (error.response) { + const { status, data } = error.response + console.log('Error: ', status, ' ', data && JSON.stringify(data)) } error = err }