Hubot with slack adapter - cannot perform rtm.star

2019-07-31 03:09发布

I'm trying to have hubot + slack on my local machine. installed hubot and slack client. running:

bin\hubot -a slack

and got error (after adding log messages to the script)

INFO Connecting...

INFO { ok: false, error: { [Error: socket hang up] code: 'ECONNRESET' } }

from reading code in node_modules\slack-client\src\client.js found the problem occurs in a POST request:

   Client.prototype.login = function() {
     this.logger.info('Connecting...');
     return this._apiCall('rtm.start', {
       agent: 'node-slack'
     }, this._onLogin);   };




  Client.prototype._apiCall = function(method, params, callback) {
     var options, post_data, req;
     params['token'] = this.token;
     post_data = querystring.stringify(params);
     options = {
       hostname: this.host,
       method: 'POST',
       path: '/api/' + method,
       headers: {
         'Content-Type': 'application/x-www-form-urlencoded',
         'Content-Length': post_data.length
       }
     };
     req = https.request(options);

tried to do: Node.js POST causes [Error: socket hang up] code: 'ECONNRESET' with no success

0条回答
登录 后发表回答