TheMaster Posted May 10 Report Posted May 10 if have no clue what this error means it started coming suddenly my account is fine E:\Bots\node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:19 if (!this.partner.isValid || !this.partner.isValid() || this.partner.type != SteamID.Type.INDIVIDUAL) { ^ TypeError: Cannot read properties of undefined (reading 'isValid') at new TradeOffer (E:\Bots\node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:19:20) at TradeOfferManager.createOffer (E:\Bots\node_modules\steam-tradeoffer-manager\lib\index.js:506:14) at sendOffer (E:\Bots\Autoconfirmbot\mainimprovements.js:168:25) at WebSocket.incoming (E:\Bots\Autoconfirmbot\modules\shadowpaysell.js:116:17) at WebSocket.emit (node:events:520:28) at Receiver.receiverOnMessage (E:\Bots\node_modules\ws\lib\websocket.js:1209:20) at Receiver.emit (node:events:520:28) at Receiver.dataMessage (E:\Bots\node_modules\ws\lib\receiver.js:594:14) at Receiver.getData (E:\Bots\node_modules\ws\lib\receiver.js:496:10) at Receiver.startLoop (E:\Bots\node_modules\ws\lib\receiver.js:167:16) Node.js v22.1.0 Quote
Dr. McKay Posted May 10 Report Posted May 10 Show how you're creating a trade offer (new TradeOffer(...)) Quote
TheMaster Posted May 14 Author Report Posted May 14 On 5/11/2024 at 4:40 AM, Dr. McKay said: Show how you're creating a trade offer (new TradeOffer(...)) i am very sorry for the late reply it seemslike the the error was happening when i was calling the sendoffer function with in valid or incomplete details but instead of showing what was the cause it was crashing the program with the above error so i adjusted the main if statement on the new trade offer to if (!this.partner?.isValid || !this.partner?.isValid() || this.partner?.type != SteamID.Type.INDIVIDUAL) { throw new Error("Invalid input SteamID " + this.partner); } in this way we safely access or try to access the contents and dosent crashes the program Quote
Dr. McKay Posted May 15 Report Posted May 15 You're treating the symptom, not the cause. There's no scenario where this.partner should be undefined or otherwise invalid unless you're doing something wrong. Quote
TheMaster Posted May 15 Author Report Posted May 15 11 minutes ago, Dr. McKay said: You're treating the symptom, not the cause. There's no scenario where this.partner should be undefined or otherwise invalid unless you're doing something wrong. I have treated the error on my end I was calling the send offer without checking partner so I fixed it I am suggesting that the error should be handled gracefully as u have written the error message but instead it crashes code Respectfully, 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.