nikoF Posted May 18, 2017 Report Posted May 18, 2017 18.05.2017 02:11:25 - HTTP error 503## Session Expired. Relogging.C:\Users\Administrator\Desktop\SteamBot\node_modules\steam-user\components\web.js:9 throw new Error("Cannot log onto steamcommunity.com without first being connected to Steam network"); ^ Error: Cannot log onto steamcommunity.com without first being connected to Steam network at SteamUser.webLogOn (C:\Users\Administrator\Desktop\SteamBot\node_modules\steam-user\components\web.js:9:9) at SteamCommunity.community.on (C:\Users\Administrator\Desktop\SteamBot\TestasDynamic.js:300:12) at emitOne (events.js:96:13) at SteamCommunity.emit (events.js:191:7) at SteamCommunity._notifySessionExpired (C:\Users\Administrator\Desktop\SteamBot\node_modules\steamcommunity\components\http.js:85:7) at C:\Users\Administrator\Desktop\SteamBot\node_modules\steamcommunity\components\confirmations.js:21:10 at C:\Users\Administrator\Desktop\SteamBot\node_modules\steamcommunity\components\confirmations.js:268:4 at SteamCommunity._checkHttpError (C:\Users\Administrator\Desktop\SteamBot\node_modules\steamcommunity\components\http.js:90:3) at Request._callback (C:\Users\Administrator\Desktop\SteamBot\node_modules\steamcommunity\components\http.js:50:61) at self.callback (C:\Users\Administrator\Desktop\SteamBot\node_modules\request\request.js:188:22) So this is the error from console.When my session expires, I use this code to come back on track: community.on('sessionExpired', (ERR) => {console.log("## Session Expired. Relogging.");client.webLogOn();}); Not sure if it synced with this code, but I will write it tooclient.on('webSession', function (sessionID, cookies) {manager.setCookies(cookies, function (err) {if (err) {console.log(dateFormat(Date(), "dd.mm.yyyy HH:MM:ss ") + " - " + err);//process.exit(1); I commented this cause I don't want to stop the node immediatelyclient.webLogOn(); // I put this in order to do webLogon again, not sure if necessaryreturn;}});community.setCookies(cookies);community.chatLogon();community.startConfirmationChecker(config.steam.refreshInterval, config.steam.secret);if (config.social.hasToUpdateProfile) {updateProfile();}}); So yeah, any ideas how to solve this problem, and not get my node getting down after this Error("Cannot log onto steamcommunity.com without first being connected to Steam network"); ? Thank you in advance! One solution would be to use forever npm, but I would like to hear other opinions how I could rework the code, to not make the node go off, because I'm not up to use that npm due to some variables being saved while bot is being up. Quote
Dr. McKay Posted May 18, 2017 Report Posted May 18, 2017 You're trying to relog the web session while Steam is down. Don't do that, and just wait for Steam to come back. It will emit webSession automatically once it reconnects successfully. Quote
nikoF Posted May 18, 2017 Author Report Posted May 18, 2017 Is this part wrong? client.webLogOn(); // I put this in order to do webLogon again, not sure if necessary Cause it doesn't get into this part tho as I see, because of the console.log() before that line which I am not able to see in the console. Or you are talking about SessionExpired part? My mind is messed up at the moment. Quote
Dr. McKay Posted May 18, 2017 Report Posted May 18, 2017 That's the correct method to use, but you can't use it if you aren't currently connected to Steam (e.g. because Steam is down). That's what's throwing that error. Quote
nikoF Posted May 19, 2017 Author Report Posted May 19, 2017 so how am I able to not go into that method, if I get an error when steam is down? SteamUser.prototype.webLogOn = function() { // Verify logged on if (!this.steamID) { throw new Error("Cannot log onto steamcommunity.com without first being connected to Steam network"); } // Verify not anonymous user if (this.steamID.type != SteamID.Type.INDIVIDUAL) { throw new Error('Must not be anonymous user to use webLogOn (check to see you passed in valid credentials to logOn)') } this._send(SteamUser.EMsg.ClientRequestWebAPIAuthenticateUserNonce, {});}; should I put something like emit on the first if condition?Or you got some different ideas how to solve the problem? Quote
Dr. McKay Posted May 20, 2017 Report Posted May 20, 2017 If Steam is down, you can't log in. I don't understand where the confusion is. Wait for Steam to come back online, and the client will reconnect on its own and emit webSession. Quote
nikoF Posted May 20, 2017 Author Report Posted May 20, 2017 The confusion is, that if I'm sleeping at that time or not near my PC, and if the steam goes down, then the node on vpn goes down too at that time,so the bot will remain offline till I start the node again. Quote
samki Posted May 29, 2017 Report Posted May 29, 2017 Just check if your steam client got a SteamID before webLogOn if (this._client.steamID !== null) { this._client.webLogOn(); } Quote
Revadike Posted June 1, 2017 Report Posted June 1, 2017 (edited) Sorry to hijack this thread, but speaking of web session. I'm using pretty much the same code as above. But my purpose is to post to my friend activity, which I am doing like this: var profileurl = "http://steamcommunity.com/"; if (vanityname) { profileurl += "id/" + vanityname; } else { profileurl += "profiles/" + client.steamID.getSteamID64(); } var formdata = new Object(); formdata.sessionid = community.getSessionID(); formdata.appid = SOMEAPPID; formdata.status_text = SOMEMESSAGE; setTimeout(function() { community.httpRequestPost(profileurl + "/ajaxpostuserstatus/", { formData: formdata, followAllRedirects: true }, function(error, response, data) { var success, json; try { json = JSON.parse(data); success = json.success; } catch (e) { success = false; } console.log(response.statusCode, success); if (error) { console.log(error); } }); }, 1000); This all works fine when I recently login. All friend activity posts will return "200 True", but after a while it only returns "200 False". I suspect the web session has expired or something, but how can that be when I use the same code as above? Any other solutions maybe? Maybe somehow refresh web session each time I want to post something, but how? Edited June 1, 2017 by Royalgamer06 Quote
Revadike Posted June 3, 2017 Report Posted June 3, 2017 So, is there any way to refresh the web session with callback? Quote
Dr. McKay Posted June 3, 2017 Report Posted June 3, 2017 webLogOn() and wait for the webSession event. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.