Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when starting bot locally. #3

Open
lastcoolnameleft opened this issue Feb 18, 2017 · 4 comments
Open

Error when starting bot locally. #3

lastcoolnameleft opened this issue Feb 18, 2017 · 4 comments

Comments

@lastcoolnameleft
Copy link
Contributor

When I clone this repo and try to run locally, I get the following error.

$ node ./server.js
/Users/thfalgou/git/tmp/echobot/node_modules/botbuilder/lib/bots/ChatConnector.js:59
        var isEmulator = req.body['channelId'] === 'emulator';
                            ^

TypeError: Cannot read property 'body' of undefined
    at ChatConnector.verifyBotFramework (/Users/thfalgou/git/tmp/echobot/node_modules/botbuilder/lib/bots/ChatConnector.js:59:29)
    at Object.<anonymous> (/Users/thfalgou/git/tmp/echobot/server.js:24:40)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:418:7)
    at startup (bootstrap_node.js:139:9)

Digging into the code, I believe that this is because server.js is not passing in expected req, res variables:

See:
https://github.com/fuselabs/echobot/blob/master/server.js#L24

https://github.com/Microsoft/BotBuilder/blob/master/Node/core/lib/bots/ChatConnector.js#L59

@lastcoolnameleft
Copy link
Contributor Author

I'm baffled as to why this is happening on server.js startup opposed to waiting till the first request comes in; however, that might be something due to restify.

@danmarshall
Copy link
Collaborator

Do you have the latest code? I just checked in an update yesterday.

@lastcoolnameleft
Copy link
Contributor Author

Yes. I just found out about the repo today. I've confirmed that HEAD points to dd52d6f.

To reproduce the problem, I run "git pull && rm -rf node_modules && npm install && npm start".

@lastcoolnameleft
Copy link
Contributor Author

I just created #4 which fixes the problem for me. I'm encountering this issue with Node v.6.6.0 after a clean clone and running "npm install && npm start"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants