yoba Posted March 12, 2017 Report Posted March 12, 2017 Please help with my problem. I do not know why the 'appid' is not defined Stack trace: Logged into Steam /Users/user/Documents/node/steam/node_modules/steam-tradeoffer-manager/lib/classes/TradeOffer.js:419 if (typeof details.appid === 'undefined' || typeof details.contextid === 'undefined' || (typeof details.assetid === 'undefined' && typeof details.id === 'undefined')) { ^ TypeError: Cannot read property 'appid' of undefined at addItem (/Users/user/Documents/node/steam/node_modules/steam-tradeoffer-manager/lib/classes/TradeOffer.js:419:20) at TradeOffer.addTheirItem (/Users/user/Documents/node/steam/node_modules/steam-tradeoffer-manager/lib/classes/TradeOffer.js:374:9) at manager.loadUserInventory (/Users/user/Documents/node/steam/project4.js:80:12) at SteamCommunity.<anonymous> (/Users/user/Documents/node/steam/node_modules/steamcommunity/components/users.js:331:5) at Request._callback (/Users/user/Documents/node/steam/node_modules/steamcommunity/components/http.js:67:15) at Request.self.callback (/Users/user/Documents/node/steam/node_modules/request/request.js:188:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request.<anonymous> (/Users/user/Documents/node/steam/node_modules/request/request.js:1171:10) at emitOne (events.js:96:13) Code: function sendRandomItem() { const partner = 'partner_code'; const appid = 730; const contextid = 2; const offer = manager.createOffer(partner); manager.loadInventory(appid, contextid, true, (err, myInv) => { if (err) { console.log(err); } else { const myItem = myInv[Math.floor(Math.random() * myInv.length - 1)]; offer.addMyItem(myItem); manager.loadUserInventory(partner, appid, contextid, true, (err, theirInv) => { if (err) { console.log(err); } else { const theirItem = theirInv[Math.floor(Math.random() * theirInv.length - 1)]; offer.addTheirItem(theirItem); offer.setMessage(`Will you trade your ${theirItem.name} for my ${myItem.name}?`); offer.send((err, status) => { if (err) { console.log(err); } else { console.log(`Sent offer. Status: ${status}.`); } }); } }); } }); } Quote
Dr. McKay Posted March 12, 2017 Report Posted March 12, 2017 Looks like one of the items you're trying to add is undefined. Perhaps someone's inventory is empty? Quote
yoba Posted March 12, 2017 Author Report Posted March 12, 2017 No, inventory on both accounts is not empty. Quote
yoba Posted March 13, 2017 Author Report Posted March 13, 2017 Logged into Steam{ Error: There was an error sending your trade offer. Please try again later. (15) at Object.exports.makeAnError (/Users/code/Documents/node/steam/node_modules/steam-tradeoffer-manager/lib/helpers.js:12:12) at SteamCommunity.manager._community.httpRequestPost (/Users/code/Documents/node/steam/node_modules/steam-tradeoffer-manager/lib/classes/TradeOffer.js:513:12) I do not understand why I get this error. What am I doing wrong? I already read about this error. But there are no restrictions on my accounts, what could be the problem? Quote
snakj Posted September 4, 2017 Report Posted September 4, 2017 yoba did you solved your problem? i'm having the same issue. already changed to other accounts and problem still alive... Quote
Andrei Elvis Posted September 27, 2017 Report Posted September 27, 2017 When you add items to the offer (with .addMyItem and .addTheirItem) you need to specify appid and contextid of items.So, instead of offer.addMyItem(myItem); Replace with: offer.addMyItem({ 'assetid': myItem.assetid, 'appid': appid, 'contextid': contextid }); Same for offer.addTheirItem(theirItem); Replace with: offer.addTheirItem({ 'assetid': theirItem.assetid, 'appid': appid, 'contextid': contextid }); Quote
woepertjes Posted March 20, 2018 Report Posted March 20, 2018 Andrei Elvis, you say you have to specify the appid and contextid of items, does the same rule apply to "addTheirItems()"? Here i am pointing to the S at the end of that function. Thanks for letting me know <3 Quote
Franz Darelle Posted April 9, 2018 Report Posted April 9, 2018 you guys have answer for this? cant get it right offer.addMyItem({ 'assetid': myItem.assetid, 'appid': appid, 'contextid': contextid }); manager.loadUserInventory( partner, appid, contextid, true, (err, theirInv) => { if (err) { console.log(err); } else { const theirItem = theirInv[Math.floor(Math.random() * theirInv.length - 1)]; offer.addTheirItem({ 'assetid': theirItem.assetid, 'appid': appid, 'contextid': contextid }); 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.