GiyoMoon / steam-server-query

Module which implements the Master Server Query Protocol and Game Server Queries.
https://npmjs.com/package/steam-server-query
MIT License
25 stars 2 forks source link

`Timeout reached` error #7

Closed jcads closed 1 year ago

jcads commented 1 year ago

Hello. I am following the API examples and I keep getting this error

Error: Timeout reached. Possible reasons: You are being rate limited; Timeout too short; Wrong server host configured;
    at GameServerQuery.info (/home/runner/steam-server-query-test/node_modules/steam-server-query/lib/gameServer/gameServer.js:73:19)

I tried it with the example server address and also with other public servers and I still get the same error.

LAxBANDA commented 1 year ago

Hi, i have published a new version in the following link: https://github.com/LAxBANDA/steam-server-query-goldsrc-support

Andrew1175 commented 1 year ago

I'm also receiving the same error:

const steamServerQuery = require('steam-server-query-goldsrc-support');

var { data } = await steamServerQuery.queryGameServerInfo('136.54.17.250:27016');
console.log(data);
Error: Timeout reached. Possible reasons: You are being rate limited; Timeout too short; Wrong server host configured;
    at GameServerQuery.info (C:\Users\andre\Documents\Steam Game Server Info Bot\node_modules\steam-server-query-goldsrc-support\lib\gameServer\gameServer.js:73:19)
    at async Object.queryGameServerInfo (C:\Users\andre\Documents\Steam Game Server Info Bot\node_modules\steam-server-query-goldsrc-support\lib\gameServer\gameServer.js:19:20)
GiyoMoon commented 1 year ago

Hey @Andrew1175 It's working for me. You aren't using this package, but a fork of it. Please use steam-server-query and try it again. Also, the response doesn't have a data property. Your code should look like this (without the curly braces around data).

var data = await steamServerQuery.queryGameServerInfo('136.54.17.250:27016');
console.log(data);

This is my code which worked:

const steamServerQuery = require('steam-server-query');

steamServerQuery.queryGameServerInfo('136.54.17.250:27016').then((result) => {
  console.log(result);
}).catch((error) => {
  console.log(error);
});

Gives:

{
  protocol: 17,
  name: '[US EAST]The Wise Guys|Duos|2xHarvest/Crafting',
  map: 'VRisingWorld',
  folder: 'V Rising',
  game: 'c1775d06-79fe-4510-8146-e58da9a2fe36',
  appId: 0,
  players: 0,
  maxPlayers: 30,
  bots: 0,
  serverType: 'd',
  environment: 'w',
  visibility: 0,
  vac: 1,
  version: '0.0.0.1',
  port: 27015,
  keywords: 'pvp,cs2,ded,sal_mi',
  gameId: 1604030n
}
GiyoMoon commented 1 year ago

The two main reasons this error happens is because the server is either completely down, or your network/server isn't fast enough to complete the request in the default 1000 milliseconds. In this case, you can increase the timeout like this:

queryGameServerInfo('136.54.17.250:27016', 1, 2000)

This increases the timeout to 2000 milliseconds. The second parameter is the amount of attempts, which is the default 1. Try around with these two parameters, you should get it working with it.

Andrew1175 commented 1 year ago

The two main reasons this error happens is because the server is either completely down, or your network/server isn't fast enough to complete the request in the default 1000 milliseconds. In this case, you can increase the timeout like this:

queryGameServerInfo('136.54.17.250:27016', 1, 2000)

This increases the timeout to 2000 milliseconds. The second parameter is the amount of attempts, which is the default 1. Try around with these two parameters, you should get it working with it.

@GiyoMoon

I changed to your package and tried again. I'm still getting the same error. Even with changing the retry attempts and timeout period. Example:

const steamServerQuery = require("steam-server-query")

steamServerQuery.queryGameServerInfo('136.54.17.250:27016', 5, 3000).then((result) => {
  console.log(result);
}).catch((error) => {
  console.log(error);
});

I get this back:

Error: Timeout reached. Possible reasons: You are being rate limited; Timeout too short; Wrong server host configured;
at GameServerQuery.info — line 73
        catch (err) {
            this._promiseSocket.closeSocket();
            throw new Error(err);
        }
at Object.queryGameServerInfo — line 19
kirbystudy commented 9 months ago

I also encountered this problem. Error: Timeout reached. Possible reasons: You are being rate limited; Timeout to short; Wrong server host configured;