This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.

⚠️ We've moved!

Hi there!

To reduce project dependency on 3rd party paid services the StackStorm TSC has decided to move the Q/A from this forum to Github Discussions. This will make user experience better integrated with the native Github flow, as well as the questions closer to the community where they can provide answers.

Use 🔗 Github Discussions to ask your questions.

ChatOps w/ Slack not working

StackStorm is fully setup in dev and work. I can run commands locally but when setting up ChatOps it does not list any aliases i created.

I followed this
https://docs.stackstorm.com/install/deb.html

then
https://docs.stackstorm.com/troubleshooting/basic_chatops_troubleshooting.html

to troubleshoot but no dice. doing a printenv does not show any of the environment exports and also getting this via debug

Feb 21 14:38:40 SERVERNAME systemd[1]: Started StackStorm service st2chatops.
Feb 21 14:38:40 SERVERNAME hubot[2902]: Thu, 21 Feb 2019 19:38:40 GMT body-parser deprecated undefined extended: provide extended option at node_modules/hubot/src/robot.js:445:21
Feb 21 14:38:40 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:40 GMT-0500 (Eastern Standard Time)] DEBUG Loading adapter slack
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] INFO hubot-slack adapter v4.5.5
Feb 21 14:38:42 SERVERNAME hubot[2902]: warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
Feb 21 14:38:42 SERVERNAME hubot[2902]: warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] DEBUG RtmClient initialized with options: undefined
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] DEBUG RtmClient#start() with options: {}
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] DEBUG SlackBot#authenticated() Found self in RTM start data
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] INFO Logged in as @stackstorm in workspace OMIT NAME
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] INFO Connected to Slack RTM
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] DEBUG Loading scripts from /opt/stackstorm/chatops/scripts
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] DEBUG Loading scripts from /opt/stackstorm/chatops/src/scripts
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] DEBUG Loading external-scripts from npm packages
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] INFO Requesting a token…
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] DEBUG Using slack post data handler.
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] DEBUG Parsing help for /opt/stackstorm/chatops/node_modules/hubot-stackstorm/scripts/stackstorm.js
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] DEBUG Parsing help for /opt/stackstorm/chatops/node_modules/hubot-help/src/help.coffee
Feb 21 14:38:42 SERVERNAME hubot[2902]: [Thu Feb 21 2019 14:38:42 GMT-0500 (Eastern Standard Time)] ERROR Failed to authenticate: Invalid or missing credentials
Feb 21 14:38:42 SERVERNAME hubot[2902]: (node:2902) UnhandledPromiseRejectionWarning: #
Feb 21 14:38:42 SERVERNAME hubot[2902]: (node:2902) 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)
Feb 21 14:38:42 SERVERNAME hubot[2902]: (node:2902) [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.

not even getting outputs from echo $ST2_HOSTNAME or any ST2 vairable

You need to configure ST2_API_KEY in /opt/stackstorm/chatops/st2chatops.env.

See the fourth bullet point in this section:
https://docs.stackstorm.com/install/deb.html#setup-chatops

Wow, seriously i read that line 200 times and thought it meant that the ENV variables passed would have worked. BUT i manually added the key and boom! restart and works

@blag works perfect, but noticed for this simple cmd it only displays the result
“action completed”


name: “remote_shell_cmd”
pack: “examples”
action_ref: “core.remote”
description: “Execute a command on a remote host via SSH.”
formats:

  • “run {{cmd}} on {{hosts}}”

from
https://docs.stackstorm.com/chatops/chatops.html

the output thou, lets say i run !run date on localhost, completes and i can see the result inside the webgui or cli. but not in slack. something else i missed ?

going to try and add
result:
format: |
Ran command {{execution.parameters.cmd}} on {{ execution.result | length }} hosts.

Details are as follows:
{% for host in execution.result -%}
    Host: *{{host}}*
    ---> stdout: {{execution.result[host].stdout}}
    ---> stderr: {{execution.result[host].stderr}}
{%+ endfor %}

worked :expressionless:

Did you get this working?

Yes thank you, it was the API key was not added