psdlt / roboape

A simple bot which will buy into every new BNB pair created on PancakeSwap
77 stars 46 forks source link

CONNECTION ERROR: The connection got closed with the close code `1006` #11

Closed linscomt closed 2 years ago

linscomt commented 2 years ago

***Title: CONNECTION ERROR: The connection got closed with the close code 1006

Hello.

when i compiled 'npm run build' and executed 'node build/app.js' the following error appeared:

To execute it 'npm run build' the following error occurs:

w H((function(e){e(i)}))).then(n,r)}i(($=$.apply(U,W||[])).next())}))})()})();

Error: connection not open on send() at Object.ConnectionError (C:\xampp\htdocs-hostnames\Pancakeswap\roboape-main-01\roboape-main\build\app.js:2:2359375) at Object.ConnectionNotOpenError (C:\xampp\htdocs-hostnames\Pancakeswap\roboape-main-01\roboape-main\build\app.js:2:2358727) at C:\xampp\htdocs-hostnames\Pancakeswap\roboape-main-01\roboape-main\build\app.js:2:2687754 at Map.forEach () at a._onClose (C:\xampp\htdocs-hostnames\Pancakeswap\roboape-main-01\roboape-main\build\app.js:2:2687718) at l.i [as dispatchEvent] (C:\xampp\htdocs-hostnames\Pancakeswap\roboape-main-01\roboape-main\build\app.js:2:2831894) at l.p (C:\xampp\htdocs-hostnames\Pancakeswap\roboape-main-01\roboape-main\build\app.js:2:2732749) at m. (C:\xampp\htdocs-hostnames\Pancakeswap\roboape-main-01\roboape-main\build\app.js:2:2732162) at m.emit (node:events:394:28) at m.failHandshake (C:\xampp\htdocs-hostnames\Pancakeswap\roboape-main-01\roboape-main\build\app.js:2:2739049) at ClientRequest. (C:\xampp\htdocs-hostnames\Pancakeswap\roboape-main-01\roboape-main\build\app.js:2:2737788) at ClientRequest.emit (node:events:394:28) at HTTPParser.parserOnIncomingClient (node:_http_client:621:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17) at TLSSocket.socketOnData (node:_http_client:487:22) at TLSSocket.emit (node:events:394:28) { code: 1006, reason: 'connection failed' }

To execute it 'npm run dev' the same error occurs:

webpack://robo-ape/./node_modules/web3-core-helpers/lib/errors.js?:66 const error = new Error(msg); ^

Error: connection not open on send() at Object.ConnectionError (webpack://robo-ape/./node_modules/web3-core-helpers/lib/errors.js?:66:23) at Object.ConnectionNotOpenError (webpack://robo-ape/./node_modules/web3-core-helpers/lib/errors.js?:49:21) at eval (webpack://robo-ape/./node_modules/web3-providers-ws/lib/index.js?:155:37) at Map.forEach () at WebsocketProvider._onClose (webpack://robo-ape/./node_modules/web3-providers-ws/lib/index.js?:154:27) at W3CWebSocket._dispatchEvent [as dispatchEvent] (webpack://robo-ape/./node_modules/yaeti/lib/EventTarget.js?:115:12) at W3CWebSocket.onConnectFailed (webpack://robo-ape/./node_modules/websocket/lib/W3CWebSocket.js?:219:14) at WebSocketClient.eval (webpack://robo-ape/./node_modules/websocket/lib/W3CWebSocket.js?:59:25) at WebSocketClient.emit (node:events:376:20) at WebSocketClient.failHandshake (webpack://robo-ape/./node_modules/websocket/lib/WebSocketClient.js?:339:10) at ClientRequest.eval (webpack://robo-ape/./node_modules/websocket/lib/WebSocketClient.js?:278:18) at ClientRequest.emit (node:events:376:20) at HTTPParser.parserOnIncomingClient (node:_http_client:660:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:126:17) at TLSSocket.socketOnData (node:_http_client:526:22) at TLSSocket.emit (node:events:376:20) { code: 1006, reason: 'connection failed' }

Does anyone know if the problem is with the address PROVIDER: WEB3_WS_PROVIDER=wss://bsc-ws-node.nariox.org:443

Output captured from lib/errors.js:

WEB3-CORE-Msg: CONNECTION ERROR: The connection got closed with the close code 1006 and the following reason string connection failed WEB3-CORE-Event: _Event { type: 'close', isTrusted: false, _yaeti: true, code: 1006, reason: 'connection failed', wasClean: false, target: W3CWebSocket { _listeners: { message: [Array], open: [Array], close: [Array] }, addEventListener: [Function: _addEventListener], removeEventListener: [Function: _removeEventListener], dispatchEvent: [Function: _dispatchEvent], _url: 'wss://bsc-ws-node.nariox.org:443', _readyState: 3, _protocol: undefined, _extensions: '', _bufferedAmount: 0, _binaryType: 'arraybuffer', _connection: undefined, _client: WebSocketClient { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, config: [Object], _req: null, protocols: [], origin: undefined, url: [Url], secure: true, base64nonce: 'h0vqyIvqgWnBjFGMlVeUsg==',

}

}, cancelable: true, stopImmediatePropagation: [Function (anonymous)] }

WEB3-CORE-Event-Target: W3CWebSocket { _listeners: { message: [ [Function: bound ] ], open: [ [Function: bound ] ], close: [ [Function: bound ] ] }, addEventListener: [Function: _addEventListener], removeEventListener: [Function: _removeEventListener], dispatchEvent: [Function: _dispatchEvent], _url: 'wss://bsc-ws-node.nariox.org:443', _readyState: 3, _protocol: undefined, _extensions: '', _bufferedAmount: 0, _binaryType: 'arraybuffer', _connection: undefined, _client: WebSocketClient { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, config: { maxReceivedFrameSize: 1048576, maxReceivedMessageSize: 8388608, fragmentOutgoingMessages: true, fragmentationThreshold: 16384, webSocketVersion: 13, assembleFragments: true, disableNagleAlgorithm: true, closeTimeout: 5000, tlsOptions: {} }, _req: null, protocols: [], origin: undefined, url: Url { protocol: 'wss:', slashes: true, auth: null, host: 'bsc-ws-node.nariox.org:443', port: '443', hostname: 'bsc-ws-node.nariox.org', hash: null, search: null, query: null, pathname: '/', path: '/', href: 'wss://bsc-ws-node.nariox.org:443/' }, secure: true, base64nonce: 'h0vqyIvqgWnBjFGMlVeUsg==',

} } WEB3-CORE-Msg: connection not open on send()

System Windows 10, node -v v15.4.0, npm -v 7.20.2, postgres13

happyleow commented 2 years ago

Hi I am concerned if the project works on windows env. This is a free bsc websocket endpoint and this may not be worked. So you need to use another bsc websocket for subscribing bsc events.

linscomt commented 2 years ago

Hi. Thanks for replying.

I tested it on linux, on "Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-73-generic x86_64)" on server aws, also tested on Virtualbox(ubuntu), but it worked normal on windows10 i configured windows10 to test and yes it is bad to configure and run on windows10, on ubuntu it was easy, until this connection message appeared. I created 3 free keys on https://bscscan.com/s_checkout but all are showing the same error. I hadn't thought of the free bsc websocket endpoint, that must be it. You have suggestions for a place to create free and paid endpoint, I searched for "free bsc websocket endpoint" but I didn't find anything like that. But searching I found https://docs.binance.org/smart-chain/developer/create-wallet.html and "https://docs.binance.org/api-reference/dex-api/ws-connection.html" I'm looking for other sources where I can find bsc websocket. If you or someone else has something in mind, I accept suggestions.

happyleow commented 2 years ago

You need to get a new server. There are several rpc providers on the internet like ankr/getblock... You can deploy a full bsc node and receive websocket, http events. I hope this helps.

linscomt commented 2 years ago

Thanks Thorhus.

I found the ankr.com address, I will create a token and test it. I'm going to research how to deploy a node in local host. Thank you for the clarification.