I can´t figure why it is giving me this error while starting the node app:
C:\Users\alien\Desktop\SCBM\Bot\SteamCardBot-master>node index.js
C:\Users\alien\Desktop\SCBM\Bot\SteamCardBot-master\utils.js:36
for (let i = 0; i < c.sets.length; i++) {
^
TypeError: Cannot read property 'length' of undefined
at Request.request [as _callback] (C:\Users\alien\Desktop\SCBM\Bot\SteamCard
Bot-master\utils.js:36:40)
at Request.self.callback (C:\Users\alien\Desktop\SCBM\Bot\SteamCardBot-maste
r\node_modules\request\request.js:186:22)
at emitTwo (events.js:125:13)
at Request.emit (events.js:213:7)
at Request.<anonymous> (C:\Users\alien\Desktop\SCBM\Bot\SteamCardBot-master\
node_modules\request\request.js:1163:10)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at IncomingMessage.<anonymous> (C:\Users\alien\Desktop\SCBM\Bot\SteamCardBot
-master\node_modules\request\request.js:1085:12)
at Object.onceWrapper (events.js:314:30)
at emitNone (events.js:110:20)
While I am trying to retrieve the info ('getCardsInSets') from Steam API it produces an error from :
t.getCardsInSets = (callback) => {
request("http://storage.googleapis.com/cdn.steam.tools/data/set_data.json", { json: true }, (ERR, RES, BODY) => {
if (!ERR && RES.statusCode == 200 && BODY) {
let c = BODY,
d = {};
for (let i = 0; i < c.sets.length; i++) {
d[c.sets[i].appid] = { appid: c.sets[i].appid, name: c.sets[i].game, count: c.sets[i].true_count };
}
callback(null, d);
} else {
callback(ERR);
}
});
};