Jump to content
McKay Development

Weird error

Recommended Posts

if have no clue what this error means it started coming suddenly my account is fine 

        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

Link to comment
Share on other sites

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 
Link to comment
Share on other sites

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



Link to comment
Share on other sites

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.

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.

  • Create New...