[Question] Different behaviour of prompts in emulator and azure
System Information (Required)
- SDK Platform: windows 10
- SDK Version: 3.0.2(botbuilder-azure),3.8.3(botbuilder),restify(4.3.0)
- Development Environment: localhost | Azure Bot Service | Azure App Service | other
Issue Description
When a prompt occurs in a dialog that is being called in bot.on(), the prompt behaves differently on azure and emulator
Example Code
// For more information about this template visit http://aka.ms/azurebots-node-qnamaker
"use strict";
var builder = require('botbuilder');
var botbuilder_azure = require("botbuilder-azure");
var path = require('path');
//ENV variables are checked for development mode
require('dotenv').load();
var useEmulator = (process.env.NODE_ENV == 'development');
//Universal Bot is configured by chatconnector to communicate either with the emulator or any other channels.
var connector = useEmulator ? new builder.ChatConnector() : new botbuilder_azure.BotServiceConnector({
appId: process.env['MicrosoftAppId'],
appPassword: process.env['MicrosoftAppPassword'],
stateEndpoint: process.env['BotStateEndpoint'],
openIdMetadata: process.env['BotOpenIdMetadata']
});
if (useEmulator) {
var restify = require('restify');
var server = restify.createServer();
server.listen(3978, function() {
console.log('test bot endpont at http://localhost:3978/api/messages');
});
server.post('/api/messages', connector.listen());
} else {
module.exports = { default: connector.listen() }
}
var bot = new builder.UniversalBot(connector);
bot.localePath(path.join(__dirname, './locale'));
bot.on('conversationUpdate', function (message,session) {
if (message.membersAdded) {
message.membersAdded.forEach(function (identity) {
if (identity.id === message.address.bot.id) {
bot.beginDialog(message.address,'/next');
}
});
}
});
bot.dialog('/next',[
function(session,args,next)
{
builder.Prompts.text(session,"Enter your name");
},
function(session) {
session.userData.name = session.message.text;
session.endDialog();
}
]);
bot.dialog('/',[
function(session) {
session.send("Hello "+ session.userData.name);
}]);
Steps to Reproduce
- Create a new simple bot on azure with the same code and one on the local system
- Run the bots on azure and localsystem
- enter your name and notice how they give different outputs
Expected Behavior
both the bots should have printed hello nameOfUser
Actual Results
When the bot ran locally on the emulator, the flow went to the second step of the waterfall in dialog '/next' whereas on azure we do not see this happen and after the prompt statement our input is being handled by '/' dialog and not the second step of the waterfall
@Jake1996 The Node.js app templates from the Azure Bot Service have a specific purpose, which is to demonstrate the functionality of the Bot Service. They are not necessarily designed for local deployment as you observed. This is expected behavior.
Isn't the local environment and the emulator designed for development ? If so, then differing behaviour is rather detrimental.