BotFramework-Hubot icon indicating copy to clipboard operation
BotFramework-Hubot copied to clipboard

Botbuilder dependency

Open spezam opened this issue 7 years ago • 10 comments

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.

spezam avatar Oct 04 '18 05:10 spezam

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.

angegar avatar Nov 10 '18 22:11 angegar

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 [email protected] && bin/hubot -n $HUBOT_NAME --adapter botframework"

spezam avatar Nov 11 '18 06:11 spezam

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.

angegar avatar Nov 11 '18 12:11 angegar

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 [email protected] && /home/hubot/bin/hubot --adapter botframework"

just for testing.

spezam avatar Nov 12 '18 07:11 spezam

@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.

angegar avatar Nov 12 '18 08:11 angegar

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.

spezam avatar Nov 12 '18 08:11 spezam

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

MatSFT avatar Nov 12 '18 23:11 MatSFT

@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 [email protected] resolved the issue.

esell avatar Jun 13 '19 13:06 esell

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.

agxs avatar Feb 24 '20 10:02 agxs

Alternatively add a resolutions section to your package.json

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

65Mustang289 avatar Aug 08 '20 00:08 65Mustang289