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

Issue using botkit cms locally within botkit #24

Open
mdemin914 opened this issue Jun 3, 2019 · 6 comments
Open

Issue using botkit cms locally within botkit #24

mdemin914 opened this issue Jun 3, 2019 · 6 comments
Assignees

Comments

@mdemin914
Copy link

Hey,

I am trying to get botkit-cms working locally within a botkit app. I think this would be ideal for a production deployment, not having to rely on another server to be up.

I am using

"botkit": "^4.0.2",
"botkit-cms": "0.0.4",
"botkit-plugin-cms": "^1.0.1",

When I follow the directions and include:

var cms = require('botkit-cms')();
cms.useLocalStudio(controller);

cms.loadScriptsFromFile(__dirname + '/scripts.json').catch(function(err) {
  console.error('Error loading scripts', err);
});

I get the following error: TypeError: Cannot set property 'evaluateTrigger' of undefined.

I fixed here this by changing the controller.studio references to be controller.plugins.cms. This seems to fix the problem and things seem to more or less work. The bot responds to the triggers that are setup.

However, there is an exception when the input is something that doesn't cause any triggers to be returned.

Error in trigger handler undefined
(node:53014) UnhandledPromiseRejectionWarning: Error:
  at Botkit.<anonymous> (blah/blah/node_modules/botkit/src/core.ts:1036:27)

Thanks for any help or direction on how to continue looking into this.

@zwenza
Copy link

zwenza commented Aug 30, 2019

I have the same error, any ideas?

@etiennellipse
Copy link

@mdemin914 I applied your suggested partial fix to botkit_mutagen.js with the latest version of Botkit (4.5.0) and I am still getting the (almost) same error.

    controller.plugins.cms.evaluateTrigger = function(text) {
                                           ^

TypeError: Cannot set property 'evaluateTrigger' of undefined
    at module.exports (/...myproject/node_modules/botkit-cms/src/botkit_mutagen.js:4:44)

Am I missing something?

@benbrown
Copy link
Contributor

The Botkit-cms plugin has not been properly updated yet to run locally in Botkit 4+. So this is an imperfect solution for now.

@etiennellipse
Copy link

@benbrown Do you think this is fixable? I might have someone from my team look into this next week.

@benbrown
Copy link
Contributor

Yeah it is definitely fixable.

@etiennellipse
Copy link

This should be fixed by howdyai/botkit#1851 !

@benbrown benbrown self-assigned this Nov 11, 2019
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

Successfully merging a pull request may close this issue.

4 participants