chatops.post_message returns success while nothing sent out to slack.
From below log message it looks like chatops is disconnected from stream.
Jan 04 12:13:30 st2-hostname.com hubot[3610]: [Thu Jan 04 2018 12:13:30 GMT+0000 (UTC)] ERROR Stream error: Event { type: 'error', status: 404 }
Thanks for the report. I just ran a check with my 2.5.1 system, and chatops.post_message works for me.
So we'll need to check a few things on your side, to narrow it down a bit:
/var/log/nginx/st2webui.access.log:127.0.0.1 - - [04/Jan/2018:07:41:01 -0800] "GET /api/v1/stream?st2-api-key=MDJjZjg0MTUwNjYzOGI1Y2U2NjM3MWRhNjlhMWFlNzzdvjLKSHFJKEFJEJFKJEFHKEFHFNkYg HTTP/1.1" 200 7724783 "-" "-"/var/log/st2/st2chatops.log/var/log/st2/st2stream.log, after you've restarted st2chatops. Mask API keysIt's the 404 error that is most suspicious to me. Makes me wonder if your nginx.conf doesn't have a mappings for stream.
Oh and finally: Has this ever worked? Is this a new system where it never worked, or is this an upgraded system where it used to work?
@LindsayHill Thank you for pointing possible problems to fix.
I've managed to fix our problem and here are the details on what was the issue and the workaround.
A bit of info for the setup first. This is a single node installation using Puppet and the puppet2-st2 module using ::st2::profile::fullinstall profile provided in the module. st2chatops in this install is using authentication token and not API key.
The problem seemed to be in the $ST2_API environment variable. The Puppet module set it by default to 'http://127.0.0.1:9101' and st2chatops was not able to connect to the stream service. Changing this value to https://${ST2_HOSTNAME}/api (where $ST2_HOSTNAME = 127.0.0.1) fixes the problem.
Maybe there should be a fix in the puppet-st2 module. Should we create a new issue for the puppet module or we can use this one?
@newsbreaker yes, sounds like a new issue in the puppet-st2 repo would be the best way to go.
@newsbreaker I'm not sure which version of puppet-st2 you're using. The latest version that was just released is 1.0.0-rc. In this new version we've fixed many of the st2chatops bugs. Could you please re-test with this latest version?
@newsbreaker there is a new version of puppet-st2 released late yesteday (v1.0.0-rc2) that fixes your issue. Please go check it out on forge https://forge.puppet.com/stackstorm/st2
If you have any problems with it, please don't hesitate to create an issue on the puppet-st2 repo: https://github.com/StackStorm/puppet-st2
Thank you the fix works and I no longer need to overwrite the chatops::api_url and chatops::auth_url
Most helpful comment
@newsbreaker there is a new version of
puppet-st2released late yesteday (v1.0.0-rc2) that fixes your issue. Please go check it out on forge https://forge.puppet.com/stackstorm/st2If you have any problems with it, please don't hesitate to create an issue on the
puppet-st2repo: https://github.com/StackStorm/puppet-st2