Mukesh S
Mukesh S

Reputation: 377

Skype integration error with Node -[TypeError: Cannot read property 'logger' of undefined]

I'm using the skype client for bot application. As soon as the server received the first message, an (internal) error was found on the server log.

Example code

var restify = require('restify');
var builder = require('botbuilder');
var calling = require('botbuilder-calling');

//=========================================================
// Bot Setup
//=========================================================

// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
   console.log('%s listening to %s', server.name, server.url); 
});

// Create chat bot
var chatConnector = new builder.ChatConnector({
     appId: process.env.MICROSOFT_APP_ID,
    appPassword: process.env.MICROSOFT_APP_PASSWORD
});
var chatBot = new builder.UniversalBot(chatConnector);
server.post('/api/messages', chatConnector.listen());

// Create calling bot
var connector = new calling.CallConnector({
    callbackUrl: 'https://<your host>/api/calls',
    appId: process.env.MICROSOFT_APP_ID,
    appPassword: process.env.MICROSOFT_APP_PASSWORD
});
var callingBot = new calling.UniversalCallBot(connector);
server.post('/api/calls', connector.listen());

//=========================================================
// Chat Dialogs
//=========================================================
// Add root dialog
chatBot.dialog('/', function (session) {
    session.send('Hi... Please call me to interact with me.'); 
});

callingBot.dialog('/', function (session) {
    session.send('Watson... come here!');
});;

When I run this node file

node app.js 

Expected Behavior

What you expected to happen. I expect skype client would receive a response from the chatbot and callingBot

Actual Results

The following error occured

/home/marcus/advbot/node_modules/botbuilder/node_modules/promise/lib/done.js:10
      throw err;
      ^

TypeError: Cannot read property 'logger' of undefined
    at UniversalBot.Library.findActiveDialogRoutes (/home/marcus/advbot/node_modules/botbuilder/lib/bots/Library.js:135:20)
    at /home/marcus/advbot/node_modules/botbuilder/lib/bots/Library.js:243:31
    at /home/marcus/advbot/node_modules/botbuilder/node_modules/async/lib/async.js:718:13
    at async.forEachOf.async.eachOf (/home/marcus/advbot/node_modules/botbuilder/node_modules/async/lib/async.js:233:13)
    at _parallel (/home/marcus/advbot/node_modules/botbuilder/node_modules/async/lib/async.js:717:9)
    at Object.async.parallel (/home/marcus/advbot/node_modules/botbuilder/node_modules/async/lib/async.js:731:9)
    at /home/marcus/advbot/node_modules/botbuilder/lib/bots/Library.js:241:23
    at UniversalBot.Library.recognize (/home/marcus/advbot/node_modules/botbuilder/lib/bots/Library.js:68:13)
    at UniversalBot.Library.defaultFindRoutes (/home/marcus/advbot/node_modules/botbuilder/lib/bots/Library.js:236:14)
    at UniversalBot.Library.findRoutes (/home/marcus/advbot/node_modules/botbuilder/lib/bots/Library.js:85:18)
marcus@AppBuilderBot:~/advbot/calling$ A

Upvotes: 2

Views: 763

Answers (1)

pomarc
pomarc

Reputation: 2224

I've solved the issue adding

bot.use(builder.Middleware.dialogVersion({ version: 1.0, resetCommand: /^reset/i }));

as I've read in https://github.com/Microsoft/BotBuilder/issues/2846

Upvotes: 1

Related Questions