Need some help with Ubuntu, Node, and tmi.js

Sorry wasn’t sure if I should create a new thread of just stick with the old one so please let me know if I should just go back to the other one.

I am running Ubuntu 18.04 from Vultr. Nodejs v10.5.0 and am getting this error. No issue if I run it on my personal machine. I am somewhat new to node and twitch dev in general but am a complete newb when it comes to ubuntu/vps’s Here is the stripped down bot that is giving me the error below:

[05:52] error: Reconnecting in 2 seconds..
(node:3853) UnhandledPromiseRejectionWarning: Unable to connect.
(node:3853) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 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(). (rejection id: 1)
(node:3853) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[05:52] error: Reconnecting in 2 seconds..
(node:3853) UnhandledPromiseRejectionWarning: Unable to connect.
(node:3853) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 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(). (rejection id: 2)

Your app keeps crashing because you are not handling promise rejections. Any unhandled promise rejections will terminate the application process.

For some reason you can’t connect to server, and when your script got error, then you got crash of script.
add this code in your script and you will know what happens

process.on('unhandledRejection', (reason, p) => {
  console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
})
1 Like

Hey thanks for the reply, been busy with work but just got to try this. Unfortunately all it tells me is “reason: Unable to connect.”

My problem with that is it works fine on my local machine so I am not sure why it isn’t connecting here?

You got a firewall on “production” and it’s blocking outbound data on the relevant IRC ports?

completely disabled firewall just to test it and same issue. Maybe something on VULTR’s end? I am not sure what the problem is at this point I am 100% lost.

You should be able to debug further by trying a raw connection.

$ openssl s_client -connect irc.chat.twitch.tv:6697 -quiet

and try inputting

PASS whatever
NICK justinfan123

and see if you get in. This will let you know if it’s something between the servers themselves, or an issue with your code.

What you should see in the console is this:

$ openssl s_client -connect irc.chat.twitch.tv:6697 -quiet
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, CN = DigiCert SHA2 Secure Server CA
verify return:1
depth=0 C = US, ST = California, L = San Francisco, O = "Twitch Interactive, Inc.", CN = *.chat.twitch.tv
verify return:1
PASS whatever
NICK justinfan123
:tmi.twitch.tv 001 justinfan123 :Welcome, GLHF!
:tmi.twitch.tv 002 justinfan123 :Your host is tmi.twitch.tv
:tmi.twitch.tv 003 justinfan123 :This server is rather new
:tmi.twitch.tv 004 justinfan123 :-
:tmi.twitch.tv 375 justinfan123 :-
:tmi.twitch.tv 372 justinfan123 :You are in a maze of twisty passages, all alike.
:tmi.twitch.tv 376 justinfan123 :>

So I switched to Ubuntu 16.04 and got an IPv4 (Ubuntu 18.04 on Vultr didn’t include one) and it seems to work fine. I am not sure if it was the 18.04 issue or if it was the IPv4 but all is well. I will probably spin up another server and switch to Ubuntu 18.04 with a reserved IPv4 to see find that out.

Possibly unrelated but, I was researching an issue for someone where Java applications would not connect to URLs. It turned out to be a keystore issue.

Again, probably unrelated but, since you mentioned 18.04 didn’t work but 16.04 does, I just wanted to mention it in case it was related in any way.

Cheers

IPv6 would be the issue there. You need IPv4 connectivity.

1 Like

Twitch being outdated and not supporting IPv6 :open_mouth: Naughty naughty!

Tell that to half the ISP’s round the world…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.