Jump to content
McKay Development

Recommended Posts

Posted

Helloes people and Dr. McKay,

 

Calling loadUserInventory with an instance of TradeOfferManager throws this error (running on a nodejs vs 4 cartridge at openshift):

 

 

/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steamcommunity/components/users.js:267
    var endpoint = "/profiles/" + userID.getSteamID64();
                                         ^

TypeError: userID.getSteamID64 is not a function
    at SteamCommunity.getUserInventory (/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steamcommunity/components/users.js:267:39)
    at TradeOfferManager.options._steam.on._steam.on.TradeOfferManager.setCookies.TradeOfferManager.parentalUnlock.TradeOfferManager._checkApiKey.TradeOfferManager.loadUserInventory (/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steam-tradeoffer-manager/lib/index.js:153:18)
    at SteamUser.<anonymous> (/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/app.js:127:9)
    at emitTwo (events.js:87:13)
    at SteamUser.emit (events.js:172:7)
    at SteamUser._handlers.(anonymous function) (/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steam-user/components/logon.js:268:9)
    at SteamUser._handleMessage (/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steam-user/components/messages.js:200:29)
    at emitThree (events.js:97:13)
    at CMClient.emit (events.js:175:7)
    at CMClient._netMsgReceived (/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steam-client/lib/cm_client.js:278:8)

 

This error appears when I both instantiate tradeoffer-manager and login with another instance of steam-user, although the same error is shown when I use steamcommunity (although I guess slightly different so that the references to SteamUser are references to SteamCommunity?)...wait what?

 

Here is the related code;

var SteamUser = require('steam-user');
var SteamTotp = require('steam-totp');
var TradeOfferManager = require('steam-tradeoffer-manager');

var SU = new SteamUser();
var offers = new TradeOfferManager({
    steam:        SU,
    domain:       config.domain, 
    language:     "en",
    pollInterval: 10000,
    cancelTime:   300000
});
SteamTotp.getAuthCode(my_shared_secret, function(err, code) {
	if (err) logger.debug(err.message);
	logger.debug(code);
	SU.logOn({
		"accountName": config.username,
		"password": config.password,
		"twoFactorCode": code
	});
});

SU.on('loggedOn', function (details) {
	logger.debug("Login successful as: " + SU.steamID.getSteam3RenderedID());
	offers.loadUserInventory(my_steamID64, 570, true, function(inventory) { logger.debug(inventory);});
});

(again, same happens if I use node-steamcommunity and try to call loadUserInventory from it's own login function's callback.)

 

I have been able to enable two-factor authentication and login with steam-totp ever since, so I've no idea where the problem could lie anymore. Any ideas? Many thanks regardless.

Posted

Aha, since it seemed like some kind of internal error I didn't think it could've been the root of the problem, many thanks. However, if I try to set cookies with setCookies, this happens:

/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steamcommunity/index.js:214
	cookies.forEach(function(cookie) {
	        ^

TypeError: cookies.forEach is not a function
    at SteamCommunity.setCookies (/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steamcommunity/index.js:214:10)
    at TradeOfferManager.options._steam.on._steam.on.TradeOfferManager.setCookies.checkDone [as setCookies] (/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steam-tradeoffer-manager/lib/index.js:78:18)
    at /var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/app.js:125:10
    at SteamCommunity.<anonymous> (/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steamcommunity/index.js:162:5)
    at Request._callback (/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steamcommunity/components/http.js:67:15)
    at Request.self.callback (/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steamcommunity/node_modules/request/request.js:187:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/var/lib/openshift/579916d07628e13b0f000010/app-root/runtime/repo/node_modules/steamcommunity/node_modules/request/request.js:1044:10)
    at emitOne (events.js:77:13)

I can output the cookies passed out of the login's callback, which are represented by an alphanumeric string, but inputting them into setCookies somehow fails with this. I must be doing something very stupid again but I couldn't guess it, any help with that as well? Sorry for the inconvenience.

 

(I switched into steamcommunity again instead of steam-user, however it still logs in so I don't think I could've screwed that part up, methinks)

Posted

var bot = new SteamCommunity();
var offers = new TradeOfferManager({
steam: bot,
domain: config.domain,
language: "en",
pollInterval: 10000,
cancelTime: 300000
});
SteamTotp.getAuthCode(my_shared_secret, function(err, code) {
if (err) logger.debug(err.message);
logger.debug(code);
bot.login({
"accountName": config.username,
"password": config.password,
"twoFactorCode": code
}, function(err, cookies) {
if (err) logger.debug(err.message);
logger.debug(cookies);
logger.debug("Login successful as: " + bot.steamID.getSteam3RenderedID());
offers.setCookies(cookies, function(err) { // This is where it fails, doesn't even run the callback
if (err) logger.debug(err.message);
logger.debug("Cookies set successfully, proceeding to extracting inventory...");
offers.loadUserInventory(certain_steamid64, 570, true, function(inventory) { logger.debug(inventory);});
});
});
});
Posted

Oh my, I thought that writing the callback parameters with the correct names would give them their corresponding values, seems I done goofed, many thanks. I also needed to fix loadUserInventory by adding the contextid to the parameters and fixing the callback in the same way for the original error to not throw, in case somebody checked this post in the future (probs not tho).

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...