Skip to content

source_channel need to be string and not integer #145

Description

@alisson276

If the source_channel is not a String, like Telegram, the POST in /api/v1/aliasexecution fail with message:

Nov  6 17:14:40 stackstorm hubot: [Mon Nov 06 2017 17:14:40 GMT-0200 (-02)] DEBUG Sending command payload: {"name":"remote_shell_cmd","format":"(run|execute) {{cmd}} on {{hosts}}","command":"execute date on localhost","user":"test","source_channel":123456,"notification_route":"hubot"}
Nov  6 17:14:40 stackstorm gunicorn: 2017-11-06 17:14:40,374 INFO [-] c278448b-9896-43ed-b0e4-b298d60f9897 - 400 58 181.033ms (content_length=58,request_id='c278448b-9896-43ed-b0e4-b298d60f9897',runtime=181.033,remote_addr='127.0.0.1',status=400,method='POST',path='/v1/aliasexecution')
Nov  6 17:14:40 stackstorm hubot: [Mon Nov 06 2017 17:14:40 GMT-0200 (-02)] ERROR Failed to create an alias execution: { name: 'APIError',
Nov  6 17:14:40 stackstorm hubot: status: 400,
Nov  6 17:14:40 stackstorm hubot: message: '123456 is not of type \'string\'' }

My workarround is edit the file scripts/stackstorm.js and set:

--- chatops/node_modules/hubot-stackstorm/scripts/stackstorm.js 2017-11-06 17:13:59.878000000 -0200
+++ chatops/node_modules/hubot-stackstorm/scripts/stackstorm.edit.js    2017-11-06 17:18:03.657000000 -0200
@@ -266,7 +266,7 @@
         postDataHandler.postData({
           whisper: false,
           user: addressee.name,
-          channel: addressee.room,
+          channel: String(addressee.room),
           message: message,
           extra: {
             color: '#F35A00'
@@ -283,7 +283,7 @@
       'format': format_string,
       'command': command,
       'user': addressee.name,
-      'source_channel': addressee.room,
+      'source_channel': String(addressee.room),
       'notification_route': env.ST2_ROUTE || 'hubot'
     };

@@ -296,7 +296,7 @@
         'parameters': {
           'uuid': twofactor_id,
           'user': addressee.name,
-          'channel': addressee.room,
+          'channel': String(addressee.room),
           'hint': action_alias.description
         }
       });

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions