DoctorMcKay / node-steam-session

Node.js module for authenticating with the Steam auth server. Allows for generating refresh tokens and web auth cookies for use with steam-user and other packages.
https://www.npmjs.com/package/steam-session
MIT License
112 stars 20 forks source link

Uncaught exception at steam-user#webLogOn() #43

Closed nolddor closed 1 month ago

nolddor commented 1 month ago

Describe the bug

A fatal error was thrown and not caught at today's log after session expired:

[2024-08-03 02:02:22] [Auth] The steamcommunity.com web session has expired. Re-connecting...     

node_modules/steam-session/dist/helpers.js:14                                                                                                            
    let err = new Error(errorMessage || resultMsg);                                                                                                                                      
              ^                                                                                                                                                                          

Error: Timeout                                                                                                                                                                           
    at eresultError (node_modules/steam-session/dist/helpers.js:14:15)                                                                                   
    at AuthenticationClient.sendRequest (node_modules/steam-session/dist/AuthenticationClient.js:242:46)                                                 
    at async AuthenticationClient.generateAccessTokenForApp (node_modules/steam-session/dist/AuthenticationClient.js:210:22)                             
    at async LoginSession.refreshAccessToken (node_modules/steam-session/dist/LoginSession.js:761:29)                                                    
    at async LoginSession.getWebCookies (node_modules/steam-session/dist/LoginSession.js:670:17) {                                                       
  eresult: 16                                                                                                                                                                            
}   

Faulty code at my side was:

Bot.prototype.onWebSessionExpired = function() {
    /*
     * We cannot log onto steamcommunity.com without first being connected to Steam network,
     * If we are not connected to Steam network, then client.steamID is not set
     * Further info at https://dev.doctormckay.com/topic/2213-cannot-log-onto-steamcommunitycom-without-first-being-connected-to-steam-network/?tab=comments#comment-7292
     */
    if(this.client.steamID) {
        logger.debug('The steamcommunity.com web session has expired. Re-connecting...', { component: 'Auth' })
        this.client.webLogOn()
    }
}

wiki docs says there is no promise or callback to catch errors: imagen

Versions

head node_modules/steam-user/package.json 
{
        "name": "steam-user",
        "version": "5.0.10",
        "description": "Steam client for Individual and AnonUser Steam account types",
        "keywords": [
                "steam",
                "steam client",
                "steam user"
        ],
        "homepage": "https://github.com/DoctorMcKay/node-steam-user",
head node_modules/steam-session/package.json 
{
        "name": "steam-session",
        "version": "1.7.2",
        "description": "Enables authenticating with Steam",
        "keywords": [
                "steam"
        ],
        "homepage": "https://github.com/DoctorMcKay/node-steam-session",
        "bugs": {
                "url": "https://github.com/DoctorMcKay/node-steam-session/issues"
node -v
v20.13.1

npm -v
10.5.2

Screenshots and Error Logs

N/A

nolddor commented 1 month ago

Raised the issue at wrong node module. Refers to https://github.com/DoctorMcKay/node-steam-user/issues/487 instead