Hi, I am using node-steamcommunity to login and then pass the cookies to node-steam-tradeoffer-manager. Whenever session expires, I relogin and pass the cookies to tradeoffer manager:
community.on('sessionExpired', function(err) {
community.login(logOnOptions,function(err,sessionID,cookies,steamguard) {
if(err) {
connectRetry-=1;
if(connectRetry==0) {
connectRetry=5;
setTimeout(function(){logger.info("Couldn't reach server, will log in after 30 min");logIn();},1000*60*30); // try again after 30 minutes
}
}
fs.writeFile(homeDir+'data/steamguard.txt', steamguard);
logger.info("Logged into Steam");
connectRetry=5;
//use steamcommunity cookies for tradeoffer-manager
manager.setCookies(cookies, function(err) {
if (err) {
logger.error(err);
process.exit(1);
return;
}
logger.info("Got API key: " + manager.apiKey);
});
community.chatLogon(); //Log on to the chat so that bot appears online
community.startConfirmationChecker(10000,secrets.identity_secret); //poll every 10 seconds and confirm
});
});
Sometimes I get the following error:
info: Logged into Steam
C:\MyData\education\NodeJsTutorial\steam-trade-bot\node_modules\steamcommunity\index.js:212
cookies.forEach(function(cookie) {
^
TypeError: Cannot read property 'forEach' of undefined
at SteamCommunity.setCookies (C:\MyData\education\NodeJsTutorial\steam-trade-bot\node_modules\steamcommunity\index.js:212:9)
at TradeOfferManager.setCookies (C:\MyData\education\NodeJsTutorial\steam-trade-bot\node_modules\steam-tradeoffer-manager\lib\index.js:80:18)
at C:\MyData\education\NodeJsTutorial\steam-trade-bot\tradingBot.js:344:11
at SteamCommunity.<anonymous> (C:\MyData\education\NodeJsTutorial\steam-trade-bot\node_modules\steamcommunity\index.js:128:5)
at Request._callback (C:\MyData\education\NodeJsTutorial\steam-trade-bot\node_modules\steamcommunity\components\http.js:62:14)
at Request.self.callback (C:\MyData\education\NodeJsTutorial\steam-trade-bot\node_modules\steamcommunity\node_modules\request\request.js:200:22)
at emitTwo (events.js:87:13)
at Request.emit (events.js:172:7)
at Request.<anonymous> (C:\MyData\education\NodeJsTutorial\steam-trade-bot\node_modules\steamcommunity\node_modules\request\request.js:1067:10)
at emitOne (events.js:82:20)
The error is coming on the line manager.setCookies(). Am I handling it in the wrong way or is this some bug? Thanks & Regards, Bheem