Discord.JS TLS errors - javascript

I have been working on a bot for some time now. Since I updated it to v15.5.0, after a while it works fine, does exactly what I want but then crashes, giving the following error. This seems to be a TLS issue.
Error: Client network socket disconnected before secure TLS connection was established
at connResetException (node:internal/errors:631:14)
at TLSSocket.onConnectEnd (node:_tls_wrap:1565:19)
at TLSSocket.emit (node:events:388:22)
at endReadableNT (node:internal/streams/readable:1305:12)
at processTicksAndRejections (node:internal/process/task_queues:80:21)
The source code for the bot is here
Will I have to downgrade? If so, to what version of node?
I'm using this on a Windows 10 64bit computer with no proxy settings whatsoever.

This is not related to Node.js v15, but it seems like it is an issue on your end (with your connection, or your computer). this question may help you to resolve your issue.

Related

Error: LIBUSB_ERROR_ACCESS on windows machine

I was using noble node module to connect to blue-tooth devices, my code works perfectly on a mac machine, but I am facing some issues on a windows machine. I followed all the steps suggested by noble team here https://github.com/noble/noble#windows
But I face this error, any ideas why this is happening?
this.__open()
^
Error: LIBUSB_ERROR_ACCESS
at Device.usb.Device.open (C:\Users\Temp\Desktop\proj\node_modules\usb\usb.js:33:7)
at BluetoothHciSocket.bindUser (C:\Users\Temp\Desktop\proj\node_modules\bluetooth-hci-socket\lib\usb.js:73:19)
at BluetoothHciSocket.bindRaw (C:\Users\Temp\Desktop\proj\node_modules\bluetooth-hci-socket\lib\usb.js:28:8)
at Hci.init (C:\Users\Temp\Desktop\proj\node_modules\noble\lib\hci-socket\hci.js:101:35)
at NobleBindings.init (C:\Users\Temp\Desktop\proj\node_modules\noble\lib\hci-socket\bindings.js:82:13)
at Noble.<anonymous> (C:\Users\Temp\Desktop\proj\node_modules\noble\lib\noble.js:57:24)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:188:16)
This happened to me because I was apparently using the wrong libusb driver.
Using Zadig I swapped to the WinUSB driver for the devices I was trying to talk to and then I stopped getting these unexpected LIBUSB_ERROR_ACCESS errors. I think the libusb* drivers work as well.

WebSockets working on localhost, but do not work on remote Ubuntu host

I have two applications - browser based client and NodeJS based server that are both communicating using WebSockets (I'm using ColyseusJS library). Problem is, that everything works fine while I'm testing them on localhost but when I deploy the application to my Ubuntu VPS server it stops working.
The message I receive in the browser while trying to connect is:
WebSocket connection to 'ws://X.X.X.X:8001/?colyseusid=' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET
So it reaches the server (because when server is disabled the message is "Error in connection establishment: net::ERR_CONNECTION_REFUSED") but it looks like it fails on Upgrade connection operation.
What is strange is that I managed to make it work yesterday (don't know how exactly), but had so much mess on my VPS that I decided to revert machine to it's starting state. After that it stopped working (code is unchanged). Maybe there are some additional dependencies that I need to install in order to make it work on my Ubuntu Server?
I would really appreciate your help.
Have you tried to port forward the port to the ip address of the said VPS in your router config? And also check out the firewalls.

Node.js HTTP GET “ECONNRESET” Error on read

I've read all the related issues on SO and GitHub about this error and none of them seem to address this situation.
When I run the following code:
response = await axios.get('http://localhost:8082/panda, {
httpAgent: new http.Agent({ keepAlive: true, keepAliveMsecs: 10000 })
});
I get the following error:
{ Error: socket hang up
at createHangUpError (_http_client.js:345:15)
at Socket.socketOnEnd (_http_client.js:437:23)
at emitNone (events.js:110:20)
at Socket.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1059:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9) code: 'ECONNRESET' }
{ Error: read ECONNRESET
at _errnoException (util.js:1019:11)
at TCP.onread (net.js:608:25)
code: 'ECONNRESET',
errno: 'ECONNRESET',
syscall: 'read',
etc...
There's no stack trace beyond the onread call so it's unclear how I can get any additional information beyond the ECONNRESET error code (-54) passed to the onread method in net.js
This issue happens with every request - it is not intermittent.
A few observations:
when making the same request from chrome or postman the request does NOT fail
attempting to reproduce a successful request from Chrome, by using the same headers, fails
setting the accept header to use 'gzip', etc.. does not help - I have tried all the recommendations including some weird ones like setting the content length and adding a body to the request despite this being a GET request
the error always appears in net.js, but happens with both the request and axios libraries
Here's the interesting part - I can only seem to reproduce this problem reliably when I am hosting the server locally. I am able to reach the dev instance or run the server in vagrant, via a docker container, without issue.
I am running macOS Sierra 10.12.6 if that makes any difference. The server is written in Java and uses the Spring framework. Here is the RestTemplate configuration I'm using for HTTP calls:
#Bean
public RestTemplate restTemplate() {
//request timeout
int timeout = 5000;
//Connection Pooling factory with timeouts to prevent disastrous request responses
HttpComponentsClientHttpRequestFactory cf = new HttpComponentsClientHttpRequestFactory();
cf.setReadTimeout(timeout);
cf.setConnectTimeout(timeout);
cf.setConnectionRequestTimeout(timeout);
return new RestTemplate(cf);
}
I've tried messing around with these settings with no luck.
Any ideas?
I have the same issue. The cause was in my proxy settings. I make proxy-port localhost:8080 to my localhost:3000. That's why all API requests from my NodeJS app to localhost:3000 returned "ECONNRESET" Error. When I delete proxy-port, the issue was resolved. Check your net settings. Maybe it's redirecting problem
This was a known issue with NodeJS and has been resolved. Please see http.Agent: idle sockets throw unhandled ECONNRESET for details.
Also ensure you have enabled the correct security settings when opening a port on MacOS

Meteor on windows - Server crashes on code push

I installed Meteor for windows from here :
http://win.meteor.com
The server crashes almost every time I try to make live code push.
I would then have to end the mongod.exe process and run 'meteor reset' and 'meteor' to start it up back again.
Here are the logs:
=> Meteor server restarted
events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: This socket is closed.
at Socket._write (net.js:519:19)
at Socket.write (net.js:511:15)
at Socket.HttpProxy.proxyWebSocketRequest.reverseProxy.incoming.socket.on.listeners.onOutgoing (C:\Program Files\Meteor\lib\node_modules\http-proxy\lib\node-http-proxy\http-proxy.js:515:35)
at Socket.EventEmitter.emit (events.js:96:17)
at TCP.onread (net.js:397:14)
Anyone on the same boat? I read from here https://github.com/meteor/meteor/issues/513 that this has been an open issue for over 6 months.
Someone's got any workaround? Help appreciated.
The EADDRINUSE issue was fixed in 0.6.3.1-rev4, but please update to version 0.6.4 as this problem seems to have resolved the other issue by the update to the http-proxy package.
For MSI downloads see https://github.com/sdarnell/meteor/wiki/Windows
Should also appear on http://win.meteor.com soon
This is a known issue with windows for meteor : https://github.com/sdarnell/meteor/issues/7. The one on meteor's github repo might also be related. I have it too! Hopefully they sort it out soon!. Just ctrl+c to stop your server before you edit code and get it back up after you're done.
Even if you start it after this sometimes you could also get an ADDRINUSE error, which is quite frustrating.

socket.io errors when client connects

I have socket.io running successfully on my node.js installation.
info - socket.io started
The console shows it running ok, but as soon as the client (browser) connects:
socket = io.connect('<my host>:8000');
The console is kicking out an error:
crypto.js:123
return new Hash(hash);
^
TypeError: undefined is not a function
at Object.createHash (crypto.js:123:10)
at WebSocket.onSocketConnect (/node_modules/socket.io/lib/transports/websocket/hybi-16.js:120:23)
at WebSocket.handleRequest (/node_modules/socket.io/lib/transport.js:71:10)
at WebSocket.Transport (/node_modules/socket.io/lib/transport.js:31:8)
at new WebSocket (/node_modules/socket.io/lib/transports/websocket/hybi-16.js:59:13)
at new WebSocket (/node_modules/socket.io/lib/transports/websocket.js:31:17)
at Manager.handleClient (/node_modules/socket.io/lib/manager.js:661:19)
at Manager.handleUpgrade (/node_modules/socket.io/lib/manager.js:618:8)
at Server.<anonymous> (/node_modules/socket.io/lib/manager.js:123:10)
at Server.emit (events.js:88:20)
can anyone understand what this might mean?
My code has been working fine on my local machine, its only when moving it to my production server does this error happen.
It turns out it's because Node was installed with the option --without-ssl. This means it doesnt install any of the crypto stuff, which was needed by socket.it. I installed openssl, reinstalled Node, and this fixed it :)

Categories

Resources