alex7kom / node-steam-tradeoffers

Steam Trade Offers for Node.js **NO LONGER MAINTAINED**
MIT License
287 stars 100 forks source link

TypeError: str.indexOf is not a function #283

Closed woolfi182 closed 7 years ago

woolfi182 commented 7 years ago

Cheers, I use node-steam-tradeoffers, which use a long library I tried to run steamTrade.loadPartnerInventory function but had an error instead:

steamTrade.loadPartnerInventory({
                partnerSteamId: 184774529,
                appId,
                contextId,
                language: language
            }, (err,inv,curr)=> { ...});

TypeError: str.indexOf is not a function at Function.fromString (.../node_modules/long/dist/long.js:260:22) at toAccountId (.../node_modules/steam-tradeoffers/index.js:374:15)

I wrote about this trouble to Long issues #37 Think, you must know that

alex7kom commented 7 years ago

You pass an account id (which is a Number) as partnerSteamId (which is why Long crashes). You should pass the account id as partnerAccountId. partnerSteamId is 64-bit SteamID (a String).

woolfi182 commented 7 years ago

thanks, but it doesn't work too:

steamTrade.loadPartnerInventory({
                partnerSteamId: 76561198145040257,
                appId:730,
                contextId:2
            }, (err,inv,curr)=> { ...});

Error: missing required parameter

I tried to do other things, like

I set one of an above things, but it didn't help me

Other info:

alex7kom commented 7 years ago

As I said, it should be a String:

steamTrade.loadPartnerInventory({
    partnerSteamId: '76561198145040257',
    appId: 730,
    contextId: 2
}, (err,inv,curr)=> { ...});
alex7kom commented 7 years ago

Error: missing required parameter

Also make sure you initialize the library correctly and your session is valid.

woolfi182 commented 7 years ago

I sent it as a Number and as a String, but results were the same.

Error: missing required parameter

I tried to get data from url: http://steamcommunity.com/profiles/76561198145040257/inventory/json/570/2 and it was Ok

Than, I researched query built your library and was supprised, it was something like this: uri: https://steamcommunity.com/tradeoffer/new/partnerinventory/?sessionid=&partner=76561198145040257&appid=570&contextid=2 referer: https://steamcommunity.com/tradeoffer/new/?partner=184774529

So, when I pasted the above uri in a browser I had this:

{"success":false,"error":"missing required parameter"}

I think that referer needs accessToken

woolfi182 commented 7 years ago

Also make sure you initialize the library correctly and your session is valid.

I'm sure that session is valid, because I can get my inventory, but cannot get partner account

alex7kom commented 7 years ago

Make sure you setup sessionID correctly in setup(), because sessionid is missing in URL you provided above.

woolfi182 commented 7 years ago

Thanks a lot, it works clearly It was my fault, I wrote sessionId instead of sessionID.