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

[Skype] session.beginDialog("valid dialog") crashes the bot as "not found" #3857

Closed
austinhuang0131 opened this Issue Nov 30, 2017 · 2 comments

Comments

Projects
None yet
4 participants
@austinhuang0131
Copy link

austinhuang0131 commented Nov 30, 2017

Bot Info

  • SDK Platform: Node.js
  • SDK Version: 5.5.1
  • Active Channels: Seems to be mostly involved with Skype
  • Deployment Environment: Heroku

Issue Description

I use menus to let users use my functions. The procedure is as follows:

Main Menu -> Category Menu -> Function -> Category Menu

Sometimes a function (unspecific) will fail to redirect the user back to Category Menu after delivering the content.

Code Example

https://github.com/austinhuang0131/metagon/blob/master/index.js#L801 which is the /app/index.js:801:14 described in the log below.

Reproduction Steps

See issue description. The error happens after the function has been finished and the bot is going to return to the category menu.

Expected Behavior

Turn to the /image dialog, which is written in the script before.

Actual Results

The bot crashes when /image exists.

2017-11-30T14:43:02.534565+00:00 app[web.1]: /app/node_modules/botbuilder/lib/Session.js:262
2017-11-30T14:43:02.534577+00:00 app[web.1]:             throw new Error('Dialog[' + id + '] not found.');
2017-11-30T14:43:02.534578+00:00 app[web.1]:             ^
2017-11-30T14:43:02.534579+00:00 app[web.1]: 
2017-11-30T14:43:02.534580+00:00 app[web.1]: Error: Dialog[BotBuilder:/image] not found.
2017-11-30T14:43:02.534581+00:00 app[web.1]:     at Session.replaceDialog (/app/node_modules/botbuilder/lib/Session.js:262:19)
2017-11-30T14:43:02.534582+00:00 app[web.1]:     at Request._callback (/app/index.js:801:14)
2017-11-30T14:43:02.534583+00:00 app[web.1]:     at Request.self.callback (/app/node_modules/request/request.js:186:22)
2017-11-30T14:43:02.534584+00:00 app[web.1]:     at emitTwo (events.js:126:13)
2017-11-30T14:43:02.534584+00:00 app[web.1]:     at Request.emit (events.js:214:7)
2017-11-30T14:43:02.534585+00:00 app[web.1]:     at Request.<anonymous> (/app/node_modules/request/request.js:1163:10)
2017-11-30T14:43:02.534586+00:00 app[web.1]:     at emitOne (events.js:116:13)
2017-11-30T14:43:02.534586+00:00 app[web.1]:     at Request.emit (events.js:211:7)
2017-11-30T14:43:02.534587+00:00 app[web.1]:     at IncomingMessage.<anonymous> (/app/node_modules/request/request.js:1085:12)
2017-11-30T14:43:02.534587+00:00 app[web.1]:     at Object.onceWrapper (events.js:313:30)
2017-11-30T14:43:02.534588+00:00 app[web.1]:     at emitNone (events.js:111:20)
2017-11-30T14:43:02.534588+00:00 app[web.1]:     at IncomingMessage.emit (events.js:208:7)
2017-11-30T14:43:02.534589+00:00 app[web.1]:     at endReadableNT (_stream_readable.js:1056:12)
2017-11-30T14:43:02.534590+00:00 app[web.1]:     at _combinedTickCallback (internal/process/next_tick.js:138:11)
2017-11-30T14:43:02.534590+00:00 app[web.1]:     at process._tickDomainCallback (internal/process/next_tick.js:218:9)

Side Note: Could this be related to someone who does not have a Skype username (IAddress.user.name undefined)?

@austinhuang0131 austinhuang0131 changed the title [Node.js / Skype?] session.beginDialog("valid dialog") after session.endDialog() crashes the bot [Node.js / Skype?] session.beginDialog("valid dialog") crashes the bot as "not found" Nov 30, 2017

@nwhitmont nwhitmont changed the title [Node.js / Skype?] session.beginDialog("valid dialog") crashes the bot as "not found" [Skype] session.beginDialog("valid dialog") crashes the bot as "not found" Nov 30, 2017

@nwhitmont nwhitmont self-assigned this Nov 30, 2017

@nwhitmont

This comment has been minimized.

Copy link
Contributor

nwhitmont commented Nov 30, 2017

Hi @austinhuang0131 - What's happening here is you are calling session.endDialog() before you call session.replaceDialog(). Since you have already called endDialog you can't replace the dialog with anything, since the dialog is ended.

Solution: remove the call to session.endDialog() which comes before your call to session.replaceDialog(). If you need to send a message there, send it as a normal message, aka session.send().

Example:

// change this:
session.endDialog("No result. Change your query?");
session.replaceDialog("/image");

// to this:
session.send("No result. Change your query?");
session.replaceDialog("/image");

Let me know if you have any other questions.

@austinhuang0131

This comment has been minimized.

Copy link
Author

austinhuang0131 commented Dec 1, 2017

It's working. Thank you.

But still, having an endDialog before a replaceDialog works for me. Why doesn't it work for other people at random times?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment