microsoft / BotFramework-Hubot

Hubot adapter for botframework
MIT License
111 stars 40 forks source link

Botbuilder dependency #42

Open spezam opened 5 years ago

spezam commented 5 years ago

In package.json botbuilder dependency is defined as "botbuilder": ">=3.5.0"

Since botbuilder moved from version 3.15.0 to 4.0.6 the framework is downloading the latest and greates. Unfortunately Hubot is throwing an error on startup: [Thu Oct 04 2018 05:22:21 GMT+0000 (UTC)] ERROR Cannot load adapter botframework - TypeError: BotBuilder.ChatConnector is not a constructor

rolling back to 3.5.0 fix the issues.

angegar commented 5 years ago

Hi , my bot can't start with the following error :

[Sat Nov 10 2018 22:04:06 GMT+0000 (Coordinated Universal Time)] DEBUG Loading adapter botframework
[Sat Nov 10 2018 22:04:07 GMT+0000 (Coordinated Universal Time)] INFO hubot-botframework-adapter: Adapter loaded. Using appId c2d967d2-3262-4842-b348-3c1eee95a4df
[Sat Nov 10 2018 22:04:07 GMT+0000 (Coordinated Universal Time)] ERROR Cannot load adapter botframework - TypeError: this.connector.onInvoke is not a function

It sounds similar to the @spezam one.

@spezam can you please more precisely detail what did you do ? My bot previously worked without anything specified for BoBuilder.

spezam commented 5 years ago

Hi @angegar, I run the bot in a Docker container, so before starting the process I force the installation of a previous version of the botbuilder npm module, as:

CMD bash -c "npm install botbuilder@3.15.0 && bin/hubot -n $HUBOT_NAME --adapter botframework"

angegar commented 5 years ago

Hi @spezam , Thank you for your answer. This is what i did (i think) but in another way.

In the package.json i added the botbuilder dependency :

  "dependencies": {
    "aws-sdk": "^2.310.0",
    "hubot": "^3.1.1",
    "hubot-auth": "^2.1.0",
    "hubot-botframework": "https://github.com/Microsoft/BotFramework-Hubot.git",
    "hubot-diagnostics": "^1.0.0",
    "hubot-redis-brain": "^1.0.0",
    "node-ssh": "^5.1.2",
    "winston": "^3.0.0",
    "fs":"^0.0.1-security",
    "xml2js":"^0.4.19",
    "botbuilder": "3.15.0"
  },

Then in my docker file i run :

COPY "package.json" "./"

RUN yo hubot --name="devbot" --description="Bot" --owner="me" --defaults &&\
#    rm package.json && \
    rm external-scripts.json && \
    rm hubot-scripts.json

COPY "external-scripts.json" "./"
RUN npm install --save

So if i well understand it should install the good version of botbuilder.

Finally i start my bot with :

ENTRYPOINT ["/home/hubot/bin/hubot","-a","botframework"]

But i still have the same issue.

spezam commented 5 years ago

That should do the trick. Did you check what version of the botframework is in the container?

Also, I would try to change ENTRYPOINT ["/home/hubot/bin/hubot","-a","botframework"] to CMD bash -c "npm install botbuilder@3.15.0 && /home/hubot/bin/hubot --adapter botframework"

just for testing.

angegar commented 5 years ago

@spezam , Thank you a lot you help me to find a bug in my script ;) Now it is working like a charm.

For information the bug was i copied th package.json before the hubot installation, thus i guess that the chat bot installation override my package.json that explain why putting the botBuilder version in package.json did not work.

spezam commented 5 years ago

Glad it worked! Now I remember why I did the npm install on startup. Pretty horrible hack.

I'll PR a fix to the package.json, as it seems nobody has a good solution to make it work with more recent versions of botbuilder.

MatSFT commented 5 years ago

Please review this if you folks have a chance: https://github.com/Microsoft/BotFramework-Hubot/pull/44

esell commented 5 years ago

@MattSFT As an FYI, I just created a new hubot via the instructions in the README and ran into the same issue. Doing a npm install botbuilder@3.15.0 resolved the issue.

agxs commented 4 years ago

For anyone else experiencing this issue I had to make sure I was using the git url as above for hubot-botframework and NOT version 0.10.1 which npm install gives you.

65Mustang289 commented 4 years ago

Alternatively add a resolutions section to your package.json

"resolutions": {
    "**/botbuilder": "3.30.0"
  },