botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

FormFlow, same code different outcome

Open MNHarun opened this issue 8 years ago • 2 comments

Bot Info

  • SDK Platform: .NET
  • SDK Version: 3.14
  • Active Channels: Telegram, Facebook, Web Chat, Emulator
  • Deployment Environment: Azure

Issue Description

Bot is a series of dialogs down a branch that ends with a FormFlow, (like a treeview) and traverse the tree up again to the first dialog when done with the FormFlow. All dialogs are using PromptDialog.Choice and FormFlow. There's occasional await context.PostAsync() and context.Wait().

Everything works well in Emulator, Test in Web Chat and Web Chat (on the azurewebsites.net). Failed in Facebook Messenger with code : There was an error sending this message to your bot: HTTP status code InternalServerError when user opt not to proceed with the rest of the entries in the FormFlow from inside the form dialog. I'm using return new NextStep(StepDirection.Quit); as in code snippet below.

I always start all my FormFlow implementation with a Y/N question using Enum inside the form before deciding to proceed or to abandon. (Pssst...same code failed the UI in Telegram & Facebook #4239 )

Code snippet (same code as #4239 )

return new FormBuilder<CrucialInfo>()
    .Message(PromptSetImportantPersonalNFOAsk)
    .Field(new FieldReflector<CrucialInfo>(nameof(AskContinue))
    .SetPrompt(new PromptAttribute(PromptExistingDataOnRecord + " {||}") { ChoiceStyle = ChoiceStyleOptions.Auto })
    .SetFieldDescription(new DescribeAttribute(DescribeSetImportantPersonalNFOAsk))
    .SetNext((value, x) =>
        {
            x.AskContinue = (ContinueCommand)value;
            if (x.AskContinue== ContinueCommand.Yes)
            { 
                return new NextStep(new[] { nameof(Identity) }); 
            }
            else if (x.AskContinue == ContinueCommand.No)
            {
                return new NextStep(StepDirection.Quit); // Caller will handle the exception: FormCanceledException
            }
            else 
            { 
                return new NextStep(new[] { nameof(AskContinue) }); } //Todo: how to handle this? Or simply else and not else if above (and remove this)
            }))

Did this

I think the issue is with return new NextStep(StepDirection.Quit);

The Quit signal detected by caller, trigerred and perform the FormCanceledException except Facebook.

Expected Behavior

Bot should continue with the flow. Facebook triggered error There was an error sending this message to your bot: HTTP status code InternalServerError and returned the conversation to the first dialog in the conversation.

Actual Results

See the error reported in Azure - Web App Bot - Channels (above in Issue Description)

MNHarun avatar Feb 27 '18 07:02 MNHarun

Please post enough code so we can reproduce the issue on our end.

Also, have you tried debugging locally: https://blog.botframework.com/2017/10/19/debug-channel-locally-using-ngrok/

EricDahlvang avatar Feb 27 '18 23:02 EricDahlvang

Closing for lack of response.

EricDahlvang avatar Mar 22 '18 18:03 EricDahlvang