node-steam-session
node-steam-session copied to clipboard
Proxy error retry
Hey, sometimes proxy can throw code 'ECONNRESET' on connection and login or other functions crashing. Is there any way to add support for the number of retries for these errors for steam-session and steamcommunity? It's not really right to add a check to every function since these are repetitions and the code will be huge and unreadable.
Exapmles of thrown errors because of that:
Error: Proxy CONNECT 403 Forbidden
at ClientRequest.
Error: tunneling socket could not be established, statusCode=403 at ClientRequest.onConnect (/root/asd/node_modules/tunnel-agent/index.js:166:19) at Object.onceWrapper (events.js:520:26) at ClientRequest.emit (events.js:400:28) at ClientRequest.emit (domain.js:475:12) at Socket.socketOnData (_http_client.js:553:11) at Socket.emit (events.js:400:28) at Socket.emit (domain.js:475:12) at addChunk (internal/streams/readable.js:293:12) at readableAddChunk (internal/streams/readable.js:267:9) at Socket.Readable.push (internal/streams/readable.js:206:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) { code: 'ECONNRESET' }
Also got connection issue without proxy
this._session.startWithCredentials({
accountName: this._config.account_name,
password: this._config.account_password,
steamGuardCode: SteamTOTP.getAuthCode(this._config.shared_secret),
steamGuardMachineToken: hashBuffer,
});
this.log.info('Waiting for SteamUser to be connected');
'Waiting for SteamUser to be connected' wasn't logged and function crashed. It should be wrapped and catched on my side or you able to fix it in library? Appeared on 2 of 30 logins (without proxy and with proxy).
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
TypeError: jobIdBuffer.readBigInt64BE is not a function
at Promise (/root/test_bot/node_modules/steam-session/dist/transports/WebSocketCMTransport.js:234:41)
at new Promise (
Events for 'timeout' and 'error' were declared right after startWithCredentials(), but wasn't triggered. Maybe they should be put before the login or one more catch should be added directly to startWithCredentials func?
- Your proxy 403 issues are your proxy's fault. I can put auto-proxy-retries on the to-do list, but I can't guarantee I'll get to it anytime soon. Your proxy's reliability is ultimately your responsibility.
- Your
jobIdBuffer.readBigInt64BE is not a function
suggests that you're using a Node.js version that isn't supported. 12.22.0 or later is required.
- Your proxy 403 issues are your proxy's fault. I can put auto-proxy-retries on the to-do list, but I can't guarantee I'll get to it anytime soon. Your proxy's reliability is ultimately your responsibility.
- Your
jobIdBuffer.readBigInt64BE is not a function
suggests that you're using a Node.js version that isn't supported. 12.22.0 or later is required.
- I know, just asked for possible support of handling.
- It's not every login issue, it's from time to time. My node version: node -v v14.21.3
All I can suggest is that you check your environment. Maybe you're using an old node version somehow randomly.
The only reason you'd get jobIdBuffer.readBigInt64BE is not a function
is if jobIdBuffer
is a Buffer, but the readBigInt64BE
function is missing. If it were undefined somehow, you'd instead get Cannot read property 'readBigInt64BE' of undefined
.
All I can suggest is that you check your environment. Maybe you're using an old node version somehow randomly.
The only reason you'd get
jobIdBuffer.readBigInt64BE is not a function
is ifjobIdBuffer
is a Buffer, but thereadBigInt64BE
function is missing. If it were undefined somehow, you'd instead getCannot read property 'readBigInt64BE' of undefined
.
It's weird, because this issue coming not every launch. I'm made catch for it and restart trigger, so nothing to worry about.
Nodejs was installed from here
sudo sh -c "echo deb http://deb.nodesource.com/node_14.x focal main > /etc/apt/sources.list.d/nodesource.list"
P.S. Digged more detailed. The function readBigInt64BE() is a built-in Node.js method for reading a signed 64-bit integer from a buffer in big-endian byte order. It was added in Node.js version 10.4.0. My server had node version 12, then I uninstalled it and installed 14. I don't know why this error occurs. But it's wrapped and not causing issues anymore.
Just in case anyone has a similar problem and used pm2 during nodejs update
pm2 restart app --update-env
It will update $PATH variable with the new Node.js path.
Triggered few restarts and that errors were not thrown.