Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PancakeSwap Trading Bot: Client network socket disconnected before secure TLS connection was established #64

Closed
johndoe75 opened this issue May 18, 2021 · 3 comments

Comments

@johndoe75
Copy link

This issue relates to "348-pancakeswap-trading-bot". I'm running your code 1:1 without any changes except for the WebSocket URL of my Ankr project. Everytime I start, I'm getting this error:

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: Client network socket disconnected before secure TLS connection was established
    at TLSSocket.onConnectEnd (_tls_wrap.js:1095:19)
    at Object.onceWrapper (events.js:286:20)
    at TLSSocket.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at ClientRequest.req.on (/root/bsc-sniper-bot/node_modules/ws/lib/websocket.js:555:15)
    at ClientRequest.emit (events.js:198:13)
    at TLSSocket.socketErrorListener (_http_client.js:401:9)
    at TLSSocket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

I've tried it at my desktop, on a server (other network) and at my work laptop. Always the same result. None of the computers does having a proxy setup or alike.

@djammy33
Copy link

Can you check the following

Press the Windows Key
Search For Internet Options
Click on "Internet Options"
Click On "Connection"
Go to LAN Settings
Is there a checkmark in "Use Proxy Server for LAN" ? If so, try unchecking it

@johndoe75
Copy link
Author

johndoe75 commented May 18, 2021

I've tripple checked my network settings: no proxy setup (MacOS).

Also I've tried to run the code on two different hosted Linux server at different hoster as well – outside my network (Node v10.19.0) to exclude any issues with my network. Same result.

I've also stopped my local firewall (Little Snitch) to exclude this interfering with the WebSocket (never had that before, but well …)

Add: sometimes the error changes:

events.js:353
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20)
Emitted 'error' event on WebSocket instance at:
    at ClientRequest.<anonymous> (/Users/alex/Development/crypto/sniper-bot/node_modules/ws/lib/websocket.js:555:15)
    at ClientRequest.emit (events.js:376:20)
    at TLSSocket.socketErrorListener (_http_client.js:475:9)
    at TLSSocket.emit (events.js:376:20)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  errno: -54,
  code: 'ECONNRESET',
  syscall: 'read'
}

Upgrading ethers to the latest 5.1.4 did not change anything. Also manually upgrading ws-package to latest 7.4.5 did not help.

@johndoe75
Copy link
Author

First wasn't working this morning, then suddenly it worked. I suspect the issue to be on side of Ankr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants