Mattermost chatops with ST2 2.10


(ivan) #1

Hi, I can’t connect ST2 with Mattermost after change st2 version.

st2 2.10.0, on Python 2.7.6
Mattermost Version: 5.8.0

tailf /var/log/st2/st2chatops.log
[Mon Mar 11 2019 18:21:30 GMT+0000 (Coordinated Universal Time)] INFO Attempting reconnect
[Mon Mar 11 2019 18:21:30 GMT+0000 (Coordinated Universal Time)] INFO Logging in…
[Mon Mar 11 2019 18:21:30 GMT+0000 (Coordinated Universal Time)] INFO api url:http://192.168.3.150:80/api/v4/users/login
[Mon Mar 11 2019 18:21:30 GMT+0000 (Coordinated Universal Time)] ERROR Login call failed
[Mon Mar 11 2019 18:21:30 GMT+0000 (Coordinated Universal Time)] INFO Reconnecting in 28000ms
[Mon Mar 11 2019 18:21:58 GMT+0000 (Coordinated Universal Time)] INFO Attempting reconnect
[Mon Mar 11 2019 18:21:58 GMT+0000 (Coordinated Universal Time)] INFO Logging in…
[Mon Mar 11 2019 18:21:58 GMT+0000 (Coordinated Universal Time)] INFO api url:http://192.168.3.150:80/api/v4/users/login
[Mon Mar 11 2019 18:21:58 GMT+0000 (Coordinated Universal Time)] ERROR Login call failed
[Mon Mar 11 2019 18:21:58 GMT+0000 (Coordinated Universal Time)] INFO Reconnecting in 29000ms

Mattermost Log:

192.168.61.109 - - [11/Mar/2019:15:20:37 -0300] “POST /api/v4/users/login HTTP/1.1” 400 262 “-” “-” “-”

I was using st2.9 and worked fine. But hubot-matteruser adapter is other version.

ST2 2.9 hubot-matteruser - “version”: “3.10.0”

ST2 2.10 hubot-matteruser - “version”: “4.4.0”


#2

The hubot-matteruser package v4.4.0 depends on the mattermost-client v4.4.0, which does not support Mattermost v5.

There is also this:

IMPORTANT: Make sure your hubot-matteruser and mattermost-client versions match the major version of your Mattermost server so the API versions will match.

I did not bump our hubot-matteruser dependencies in the latest update because we don’t have CI setup for Mattermost (only Slack, and soon, MS Teams, hopefully we’ll add Mattermost in ST2 3.2).

That is what is officially supported.

If you absolutely need to support Mattermost 5 and you are willing to use an unsupported (and possibly unworking) configuration, you can:

cd /opt/stackstorm/chatops
npm install hubot-matteruser@5.2.0
st2ctl restart-component st2chatops

You may need to use sudo before some of those commands.

If you wish to help us out (and please do!), please test that everything works. If everything works, please report back here and I will update the dependencies for the official packages and the next release of StackStorm will officially support Mattermost 5. You are not the only users using Mattermost 5, so this will help them as well as help us, and it will allow you to run a support ChatOps configuration with Mattermost 5.

Please feel free to post back here if you run into any issues, or in our Slack #community channel.

Thanks!


(ivan) #3

Hi, I change Mattermost to v4.10.8 and chatops works only with hubot-matteruser 5.2.0 but not received the execute results and not works “post_message”, and not get any logs on Mattermost and get the follow message on st2chatops.log:

[Mon Mar 18 2019 17:47:06 GMT+0000 (Coordinated Universal Time)] DEBUG Message {
event: ‘posted’,
data:
{ channel_display_name: ‘Town Square’,
channel_name: ‘town-square’,
channel_type: ‘O’,
post:
‘{“id”:“bztgp7wyzfgu7pb5t4zy4x9q4r”,“create_at”:1552931224489,“update_at”:1552931224489,“edit_at”:0,“delete_at”:0,“is_pinned”:false,“user_id”:“y8pr9g5r4jfs8n4j7kumrt3uae”,“channel_id”:“rodush46738qxmhhsrz11q57mw”,“root_id”:"",“parent_id”:"",“original_id”:"",“message”:“Alright! Let me check if that matches anything in the StackStorm Exchange index.”,“type”:"",“props”:{},“hashtags”:"",“pending_post_id”:""}’,
sender_name: ‘bot’,
team_id: ‘9pwo7nzegpg48ctk1so3hpb5ga’ },
broadcast:
{ omit_users: null,
user_id: ‘’,
channel_id: ‘rodush46738qxmhhsrz11q57mw’,
team_id: ‘’ },
seq: 17 }
[Mon Mar 18 2019 17:47:06 GMT+0000 (Coordinated Universal Time)] INFO ping
[Mon Mar 18 2019 17:47:06 GMT+0000 (Coordinated Universal Time)] INFO ACK ping (2)
[Mon Mar 18 2019 17:47:09 GMT+0000 (Coordinated Universal Time)] DEBUG Chatops message received: {“trace_context”: null, “payload”: {“whisper”: false, “message”: “Got something for you matching ansible!{~}\n\u2022 ansible: st2 content pack containing ansible integrations\n\nI can tell you more about a particular pack, or even get it installed for you right away:\n\npack show <pack>\npack install <pack>\n\n”, “user”: “iperez”, “channel”: “rodush46738qxmhhsrz11q57mw”, “extra”: {}}}
[Mon Mar 18 2019 17:47:36 GMT+0000 (Coordinated Universal Time)] INFO ping
[Mon Mar 18 2019 17:47:36 GMT+0000 (Coordinated Universal Time)] INFO ACK ping (2)


(Lindsay Hill) #4

Rather than also downgrading Mattermost, might be better to use the combination of latest GA Mattermost plus hubot-matteruser? Otherwise you’ve introduced further complications.

Or if you’re going to use Mattermost 4.10.8, then use a 4.x version of hubot-matteruser.


(ivan) #5

If use hubot-matteruser 4.4.0 can’t connect to mattermost 4.10.8 and get the follow message on st2chatops.log:

[Mon Mar 18 2019 18:03:31 GMT+0000 (Coordinated Universal Time)] ERROR TypeError: Array.prototype.indexOf called on null or undefined
at indexOf (:null:null)
at Matteruser.message (/opt/stackstorm/chatops/node_modules/hubot-matteruser/src/matteruser.coffee:201:36, :288:51)
at Client. (/opt/stackstorm/chatops/node_modules/hubot-matteruser/src/matteruser.coffee:1:1, :5:61)
at Client.emit (events.js:182:13)
at Client.onMessage (/opt/stackstorm/chatops/node_modules/mattermost-client/src/client.coffee:279:17, :381:23)
at WebSocket. (/opt/stackstorm/chatops/node_modules/mattermost-client/src/client.coffee:224:13, :318:22)
at WebSocket.emit (events.js:182:13)
at Receiver.ontext (/opt/stackstorm/chatops/node_modules/ws/lib/WebSocket.js:841:10)
at /opt/stackstorm/chatops/node_modules/ws/lib/Receiver.js:536:18
at Receiver.applyExtensions (/opt/stackstorm/chatops/node_modules/ws/lib/Receiver.js:371:5)
at /opt/stackstorm/chatops/node_modules/ws/lib/Receiver.js:508:14
at Receiver.flush (/opt/stackstorm/chatops/node_modules/ws/lib/Receiver.js:347:3)
at Receiver.finish (/opt/stackstorm/chatops/node_modules/ws/lib/Receiver.js:541:12)
at Receiver.expectHandler (/opt/stackstorm/chatops/node_modules/ws/lib/Receiver.js:499:31)
at Receiver.add (/opt/stackstorm/chatops/node_modules/ws/lib/Receiver.js:103:24)
at Socket.realHandler (/opt/stackstorm/chatops/node_modules/ws/lib/WebSocket.js:825:20)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at Socket.Readable.push (_stream_readable.js:219:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)


#6

The installation instructions for hubot-matteruser says this:

IMPORTANT: Make sure your hubot-matteruser and mattermost-client versions match the major version of your Mattermost server so the API versions will match.

So from that, it sounds like if you want to use hubot-matteruser v4.4 then you will need to downgrade your Mattermost server all the way down to version 4.4.

But then further down in the upgrade instructions it says:

To upgrade your Hubot for Mattermost 4.4.x, find the package.json file in your Hubot directory and look for the line in the dependencies section that references hubot-matteruser . Change the verion so it points to ^5.1.0 of the client.

So to get hubot-matteruser to work with a Mattermost server version 4.4, you will need to use hubot-matteruser version 5.1.0.

I’m not sure which part of the documentation to believe, so you will need to test difference client/server version combinations yourself until you find one that works.

Unfortunately, since we don’t have CI setup for Mattermost, we can’t test this configuration. If you can try out different versions of Mattermost and hubot-matteruser and report the results back here, that would help us tremendously in helping all of our users who use Mattermost.


(ivan) #7

I can connect Mattermost 4 and 5 with hubot-matteruser 5.2.0 but only works commands. But when execute command has not result return and didn’t see any error about post_result action and post_message not works.

I use st2 2.10.0, on Python 2.7.6


(Lindsay Hill) #8

Try going through the ChatOps Troubleshooting Guide — StackStorm 2.10.4 documentation


(ivan) #9

I tried with another chat, for example Rocketchat and get the similar problem but in this case I see the follow line on st2chatops.log:

[Tue Mar 19 2019 17:52:31 GMT+0000 (Coordinated Universal Time)] ERROR TypeError: Cannot read property ‘roomID’ of undefined

And solved with this:

fix(send): · RocketChat/hubot-rocketchat@5b585c8 · GitHub

But with Mattermost didn’t see any error log, commands works but not return result_post and not send post_message.