ChoiceInput\ConfirmInput shows TypeError: Cannot read property 'getValue' of undefined in Telegram channel
See original GitHub issueVersions
bot framework v 4.9.2. nodejs 12.18.0 botbuilder-dialogs-adaptive@4.9.2-preview OS - Windows Channel Telegram
Describe the bug
I have tried to build an adaptive dialog based on the sample here : https://github.com/microsoft/BotBuilder-Samples/tree/master/experimental/adaptive-dialog/javascript_nodejs/06.todo-bot
ConfirmInput code:
new ConfirmInput().configure({
property: new StringExpression('turn.addTodo.cancelConfirmation'),
prompt: new ActivityTemplate('${ConfirmCancellation()}'),
// Allow interruptions is an expression. So you can write any expression to determine if an interruption should be allowed.
// In this case, we will disallow interruptions since this is a cancellation confirmation.
allowInterruptions: new BoolExpression(false),
// Controls the number of times user is prompted for this input.
maxTurnCount: new NumberExpression(1),
// Default value to use if we have hit the MaxTurnCount
defaultValue: new BoolExpression('=false'),
// You can refer to properties of this input via %propertyName notation.
// The default response is sent if we have prompted the user for MaxTurnCount number of times
// and if a default value is assumed for the property.
defaultValueResponse: new ActivityTemplate("Sorry, I do not recognize '${this.value}'. I'm going with '${%DefaultValue}' for now to be safe.")
}),
ChoiceInput code:
new ChoiceInput().configure({
id: 'questionID',
property: new StringExpression('turn.userAnswer'),
prompt: new ActivityTemplate('${Question()}'),
style: new EnumExpression(ListStyle.auto),
choices: new ArrayExpression(this.getChoices(this.taskProperties.choices)),
alwaysPrompt: new BoolExpression(true),
unrecognizedPrompt: new ActivityTemplate('${errUseButtons()}'),
maxTurnCount: new IntExpression(1),
allowInterruptions: new BoolExpression(true),
outputFormat: new EnumExpression(ChoiceOutputFormat.index)
}),
Everything is working on a WebChat and Emulator, but when I try to use Telegram channel, I get the following error : [onTurnError] unhandled error: TypeError: Cannot read property ‘getValue’ of undefined
Expected behavior
If I am correct Choices are supported in Telegram channel , so I expect see prompt with choices in Telegram.
[bug]
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (11 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have investigated the issue and found possible problem in choiceInput.ts file.
the problem appears when defaultLocale is not set in ChoiceInput configuration AND in Telegram channel the context.activity.locale is not set. So onRenderPrompt() it throws an error.
In WebChat channel the context.activity.locale has a value = en-us , that’s why there is no error there.
So, I guess, defaultLocale should be a mandatory and I think the code also should be fixed, because there is no sense to check for (!locale) on the next line if it throws an error before that.
@carlosscastro Have you had a chance to review the PR associated with this issue?