CiscoDevNet / botkit-webex-samples

Chatbot samples for Webex Teams built with Botkit
https://developer.cisco.com/site/spark
MIT License
45 stars 44 forks source link

Error running node helloworld.js #2

Closed 1mgtheboss closed 7 years ago

1mgtheboss commented 7 years ago

I am trying to run the Hello World bot. I am getting an error at the last step, node helloworld.js. I am running ngrok as, ngrok http 3000 or ngrok http 8080.

D:\[REDACTED]\cisco-spark\github\botkit-ciscospark-samples\node_mo
dules\botkit\lib\CiscoSparkbot.js:42
            throw new Error('Could not determine hostname of public address: ' +
 controller.config.public_address);
            ^

Error: Could not determine hostname of public address: "https://[REDACTED].ngrok.i
o"
    at Object.Sparkbot (D:\[REDACTED]\cisco-spark\github\botkit-ci
scospark-samples\node_modules\botkit\lib\CiscoSparkbot.js:42:19)
    at Object.<anonymous> (D:\[REDACTED]\cisco-spark\github\botkit
-ciscospark-samples\helloworld.js:32:25)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)
1mgtheboss commented 7 years ago

The Emoji bot is working. The Hello World bot and the DevNet bot are not working.

ObjectIsAdvantag commented 7 years ago

Hi @MGTHEBOSS

The issue seems to be related to the formatting of the bot public URL

Here is the code responsible for the issue

       var endpoint = url.parse(controller.config.public_address);
        if (!endpoint.hostname) {
            throw new Error('Could not determine hostname of public address: ' + controller.config.public_address);
        }

Can you paste the command line you're using to launch the bot, and your platform OS?

Note that the emojibot is implemented via WebSockets. As such it does not need ngrok nor PUBLIC_URL env variable. Confirms the issue comes from the PUBLIC_URL .

1mgtheboss commented 7 years ago

I'm on windows 7 professional cmd.

ObjectIsAdvantag commented 7 years ago

Reproduced on Win7, with DOS shell. Must remove the quotes on the command line => doc updated. Thank you @MGTHEBOSS