bulltrackers-module 1.0.41 → 1.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -60,13 +60,18 @@ exports.fetchAndStorePrices = async (firestore, logger, headerManager, proxyMana
|
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
// Make the API request via the proxy manager
|
|
63
|
-
const
|
|
63
|
+
const response = await proxyManager.fetch(config.etoroApiUrl, fetchOptions);
|
|
64
64
|
|
|
65
65
|
if (!response || typeof response.text !== 'function') {
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
// Force the response object into the string using JSON.stringify
|
|
67
|
+
const responseString = JSON.stringify(response, null, 2);
|
|
68
|
+
logger.log('ERROR', `[FetchInsightsHelpers] Invalid or incomplete response received. Response object: ${responseString}`);
|
|
69
|
+
|
|
70
|
+
throw new Error(`Invalid response structure received from proxy.`);
|
|
68
71
|
}
|
|
69
72
|
|
|
73
|
+
|
|
74
|
+
|
|
70
75
|
if (!response.ok) {
|
|
71
76
|
const errorBody = await response.text();
|
|
72
77
|
throw new Error(`API returned status ${response.status}: ${errorBody}`);
|