Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

TypeError: Cannot read property 'id' of undefined #16

Closed
neogeek opened this issue Oct 8, 2016 · 0 comments
Closed

TypeError: Cannot read property 'id' of undefined #16

neogeek opened this issue Oct 8, 2016 · 0 comments

Comments

@neogeek
Copy link

neogeek commented Oct 8, 2016

I'm running into an error while using this middleware along with the example code from the README. My experience with Botkit and Wit.ai is limited so I'm not sure if it's something I'm doing incorrectly or an actual bug.

I've included the code I'm testing with and the output of the console.

const Botkit = require('botkit');

const controller = Botkit.facebookbot({
    'access_token': process.env.FACEBOOK_PAGE_TOKEN,
    'verify_token': process.env.VERIFY_TOKEN
});

const wit = require('botkit-middleware-witai')({
    'token': process.env.WITAI_TOKEN
});

controller.middleware.receive.use(wit.receive);

controller.setupWebserver(process.env.PORT, (err, webserver) => {

    controller.createWebhookEndpoints(webserver, controller.spawn());

});

controller.hears(['hello'], 'message_received', wit.hears, (bot, message) => {

    bot.reply(message, 'hi!');

});
{
  "engines": {
    "node": ">=6.0"
  },
  "dependencies": {
    "botkit": "0.4.0",
    "botkit-middleware-witai": "howdyai/botkit-middleware-witai"
  }
}
Click to expand
14:55:41 web.1  | info: ERROR IN RECEIVE MIDDLEWARE:  TypeError: Cannot read property 'id' of undefined
14:55:41 web.1  |     at Ware.middleware.receive (/Users/scottdoxey/git/github/scottdoxeybot/node_modules/botkit-middleware-witai/src/botkit-middleware-witai.js:34:62)
14:55:41 web.1  |     at Ware.<anonymous> (/Users/scottdoxey/git/github/scottdoxeybot/node_modules/wrap-fn/index.js:45:19)
14:55:41 web.1  |     at next (/Users/scottdoxey/git/github/scottdoxeybot/node_modules/ware/lib/index.js:85:20)
14:55:41 web.1  |     at Ware.run (/Users/scottdoxey/git/github/scottdoxeybot/node_modules/ware/lib/index.js:88:3)
14:55:41 web.1  |     at Object.Botkit.botkit.receiveMessage (/Users/scottdoxey/git/github/scottdoxeybot/node_modules/botkit/lib/CoreBot.js:973:35)
14:55:41 web.1  |     at /Users/scottdoxey/git/github/scottdoxeybot/node_modules/botkit/lib/Facebook.js:202:45
14:55:41 web.1  |     at Layer.handle [as handle_request] (/Users/scottdoxey/git/github/scottdoxeybot/node_modules/express/lib/router/layer.js:95:5)
14:55:41 web.1  |     at next (/Users/scottdoxey/git/github/scottdoxeybot/node_modules/express/lib/router/route.js:131:13)
14:55:41 web.1  |     at Route.dispatch (/Users/scottdoxey/git/github/scottdoxeybot/node_modules/express/lib/router/route.js:112:3)
14:55:41 web.1  |     at Layer.handle [as handle_request] (/Users/scottdoxey/git/github/scottdoxeybot/node_modules/express/lib/router/layer.js:95:5)
@neogeek neogeek closed this as completed Sep 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant