Jump to content
McKay Development

logOn method timeout in Vercel serverless function


Liumy

Recommended Posts

Here are the debug logs, I add some blank lines for better reading.

"Steam: Start login" 

"Steam deug: Forcing protocol to EConnectionProtocol.WebSocket because webCompatibilityMode is enabled" 

"(node:12) [steam-user] Warning: Logging into anonymous Steam account. If you didn't expect this warning, make sure that you're properly passing your log on details to the logOn() method. To suppress this warning, pass {anonymous: true} to logOn(). (Use \"node --trace-warnings ...\" to show where the warning was created)" 

"Steam deug: API GET request to https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/?format=vdf&cellid=0&cmtype=websockets: 200" 
"Steam deug: Randomly chose websockets server ext3-iad1.steamserver.net:27032 (load = 11, wtd_load = 5.68753433227539063)" 
"Steam deug: [W1] Connecting to WebSocket CM ext3-iad1.steamserver.net:27032" 
"Steam deug: [W1] WebSocket connection success; now logging in" 
"Steam deug: Sending message: ClientLogon" 
"Steam deug: Logon message timeout elapsed. Attempting relog." 
"Steam deug: Disconnecting without sending logoff" 
"Steam deug: [W1] Ending connection and removing all listeners" 

"Steam deug: Enqueueing login attempt in 1000 ms" 
"Steam deug: Firing queued login attempt" 

"Steam deug: Forcing protocol to EConnectionProtocol.WebSocket because webCompatibilityMode is enabled" 
"Steam deug: API GET request to https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/?format=vdf&cellid=0&cmtype=websockets: 200" 
"Steam deug: Randomly chose websockets server ext1-iad1.steamserver.net:27022 (load = 11, wtd_load = 6.34135580062866211)" 
"Steam deug: [W2] Connecting to WebSocket CM ext1-iad1.steamserver.net:27022" 
"Steam deug: [W2] WebSocket connection success; now logging in" 
"Steam deug: Sending message: ClientLogon" 
"Steam deug: Logon message timeout elapsed. Attempting relog." 
"Steam deug: Disconnecting without sending logoff" 
"Steam deug: [W2] Ending connection and removing all listeners" 

"Steam deug: Enqueueing login attempt in 2000 ms" 
"Steam deug: Firing queued login attempt" 

"Steam deug: Forcing protocol to EConnectionProtocol.WebSocket because webCompatibilityMode is enabled" 
"Steam deug: API GET request to https://api.steampowered.com/ISteamDirectory/GetCMListForConnect/v0001/?format=vdf&cellid=0&cmtype=websockets: 200" 
"Steam deug: Randomly chose websockets server ext1-iad1.steamserver.net:27035 (load = 11, wtd_load = 4.44481897354125977)" 
"Steam deug: [W3] Connecting to WebSocket CM ext1-iad1.steamserver.net:27035" 
"Steam deug: [W3] WebSocket connection success; now logging in" 
"Steam deug: Sending message: ClientLogon" 
"Steam deug: Logon message timeout elapsed. Attempting relog." 
"Steam deug: Disconnecting without sending logoff" 
"Steam deug: [W3] Ending connection and removing all listeners" 

It seems that the ClientLogon method didn't get response from the Steam server.

I really appreciate if anyone could help.

Link to comment
Share on other sites

const steam = new SteamUser({
  webCompatibilityMode: true
});

steam.on("debug", (msg) => {
  console.log('Steam deug: ', msg)
});

let currentUser = null;
let currentLoginPromise: Promise<unknown> | null = null;

const login = () => {
  if (!currentLoginPromise) {
    currentLoginPromise = new Promise((resolve, reject) => {
      if (currentUser) {
        resolve(currentUser);
        return;
      }

      console.log('Steam: Start login')
      steam.logOn();

      steam.on("loggedOn", (detail) => {
        resolve(detail);
        currentUser = detail;
        console.log('Steam: login successfully', detail)
      });

      steam.on("error", (error) => {
        reject(error);
        console.log('Steam: failed to login')
      });
    });
  }

  return currentLoginPromise;
};

await login()

I simply wrape the steam.logOn in a custom login method, it will return a promise that will resolve if login successfully.

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.

Guest
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.

Loading...
×
×
  • Create New...