martynsmith / node-irc

NodeJS IRC client library
GNU General Public License v3.0
1.33k stars 424 forks source link

Deployed on Heroku, app is running, no IRC connection #481

Closed Sharaal closed 7 years ago

Sharaal commented 7 years ago

Hey,

I have a small chatbot using the "irc" package. I just initialize the irc client and add an error handler to it. The project also have a "Procfile" for Heroku with "bot: npm start". Locally all works, but after deploy on Heroku the app is running, but the IRC connection seems not to work. There is no chatbot coming online and also no errors are emitted.

Someone already have experience with that and maybe I miss something?

Some ressources:

2016-10-04T11:48:53.094809+00:00 app[bot.1]: begin to start maxdome-irc

2016-10-04T11:48:53.096420+00:00 app[bot.1]: REDIS_URL: ...

2016-10-04T11:48:53.239506+00:00 app[bot.1]: IRC_HOST: irc.freenode.net

2016-10-04T11:48:53.239511+00:00 app[bot.1]: IRC_NICK: maxdome

2016-10-04T11:48:53.481301+00:00 app[bot.1]: end of starting maxdome-irc

2016-10-04T11:48:54.482561+00:00 app[bot.1]: ping

2016-10-04T11:48:55.484043+00:00 app[bot.1]: ping
sh1omi commented 7 years ago

Add "debug: true, showErrors: true", it will show more info about the problem.

Sharaal commented 7 years ago

Thx, that output looks a bit better to find a solution:

2016-10-04T13:55:21.643299+00:00 app[bot.1]: 4 Oct 13:55:21 - Sending irc NICK/USER

2016-10-04T13:55:21.643454+00:00 app[bot.1]: 4 Oct 13:55:21 - SEND: NICK maxdome

2016-10-04T13:55:21.643716+00:00 app[bot.1]: 4 Oct 13:55:21 - SEND: USER nodebot 8 * :nodeJS IRC client

2016-10-04T13:55:30.451033+00:00 app[bot.1]: 4 Oct 13:55:30 - GOT NOTICE from the server: "*** Notice -- You need to identify via SASL to use this server"

2016-10-04T13:55:30.451537+00:00 app[bot.1]: 4 Oct 13:55:30 - Unhandled message: { command: 'ERROR',

2016-10-04T13:55:30.451539+00:00 app[bot.1]:   rawCommand: 'ERROR',

2016-10-04T13:55:30.451540+00:00 app[bot.1]:   commandType: 'normal',

2016-10-04T13:55:30.451541+00:00 app[bot.1]:   args: [ 'Closing Link: ec2-54-216-9-66.eu-west-1.compute.amazonaws.com (SASL access only)' ] }

2016-10-04T13:55:30.452175+00:00 app[bot.1]: 4 Oct 13:55:30 - Connection got "end" event

2016-10-04T13:55:30.452254+00:00 app[bot.1]: 4 Oct 13:55:30 - Connection got "close" event

2016-10-04T13:55:30.452330+00:00 app[bot.1]: 4 Oct 13:55:30 - Disconnected: reconnecting

2016-10-04T13:55:30.452369+00:00 app[bot.1]: 4 Oct 13:55:30 - Waiting 2000ms before retrying
Sharaal commented 7 years ago

I will try it with an own account for the bot and the sasl true option like descriped here: http://stackoverflow.com/questions/18687947/how-to-join-password-protected-irc-server-using-nodejs-irc-module

Sharaal commented 7 years ago

But it seems I miss something, set SASL to true and set username/password to an existing freenode account:

2016-10-04T14:17:28.222465+00:00 app[bot.1]: 4 Oct 14:17:28 - SEND: CAP REQ sasl
...
2016-10-04T14:17:36.419150+00:00 app[bot.1]: 4 Oct 14:17:36 - Unhandled message: { prefix: 'card.freenode.net',

2016-10-04T14:17:36.419161+00:00 app[bot.1]:   server: 'card.freenode.net',

2016-10-04T14:17:36.419162+00:00 app[bot.1]:   command: '904',

2016-10-04T14:17:36.419163+00:00 app[bot.1]:   rawCommand: '904',

2016-10-04T14:17:36.419163+00:00 app[bot.1]:   commandType: 'normal',

2016-10-04T14:17:36.419164+00:00 app[bot.1]:   args: [ 'maxdome', 'SASL authentication failed' ] }
Sharaal commented 7 years ago

I found the issue.

In the stackoverflow answer is said the options are: options: {sasl:true, username: "myBotName", password: "myBotPasswordHere"} But the attribute "username" must be written as "userName". So this options are needed: options: {sasl:true, userName: "myBotName", password: "myBotPasswordHere"}

Now my bot connects to freenode. Thx for the hint how to debug. :)