Skip to content

Commit 46d00c0

Browse files
committed
chore: debug incomplete/unexpected response from stocks url
1 parent f0cbb69 commit 46d00c0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

functions/lib/integration/imports/products-to-ecom.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ module.exports = async ({ appSdk, storeId, auth }, productHorus, opts) => {
9797
if (quantity !== product?.quantity && isUpdateStock) {
9898
const { stocks_url: stocksUrl, stocks_token: stocksToken } = opts.appData
9999
if (stocksUrl && stocksToken) {
100-
const res = await axios.get(`${stocksUrl}?cod_item=${COD_ITEM}`, {
100+
const url = `${stocksUrl}?cod_item=${COD_ITEM}`
101+
const res = await axios.get(url, {
101102
httpsAgent: new https.Agent({
102103
rejectUnauthorized: false
103104
}),
@@ -122,6 +123,14 @@ module.exports = async ({ appSdk, storeId, auth }, productHorus, opts) => {
122123
}
123124
inventory[`${codigoestoque}`] = qnt
124125
})
126+
} else {
127+
logger.warn(`Unexpected stocks response for ${COD_ITEM}`, {
128+
url,
129+
response: {
130+
status: res?.status,
131+
data: res?.data
132+
}
133+
})
125134
}
126135
}
127136
}

0 commit comments

Comments
 (0)