BotBuilder-Samples icon indicating copy to clipboard operation
BotBuilder-Samples copied to clipboard

Bot cannot connect to LUIS and QnA Services in Azure

Open D33TW0 opened this issue 7 years ago • 4 comments

Github issues for C# /JS / Java/ Python should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.

Sample information

  1. Sample type: BotBuilder-Samples/samples/csharp_dotnetcore/14.nlp-with-dispatch/
  2. Sample language: dotnetcore
  3. Sample name: NLP with dispatch

Describe the bug

I followed the instructions in sample 14. NLP with dispatch and everything in the Emulator works without problems (I have 2 QnA-KnowledgeBases connected). Now i want to deploy the Code to my bot in Azure. I deployed the Web app bot and published the code via VS2019 to Azure. Inside the Chat i receive the Greeting Message but when i ask a question i get three messages:

" The bot encounted an error or bug.

To run this sample make sure you have the LUIS and QnA models deployed.

To continue to run this bot, please fix the bot source code. "

To Reproduce

Steps to reproduce the behavior: 0. Deploy a Web app bot, LUIS and QnA Maker

Bildschirmfoto 2019-11-20 um 15 41 03
  1. Follow the Steps inside the Doc for 14. NLP-with-Dispatch 1,5. Add 2 more KnowledgeBases (just copy everything that is like the first KB)
  2. Deploy the Code via VS2019 to the Web App Bot in Azure
  3. Ask a Question in the Test in Webchat (The Question must be in the KB and in the LUIS Dispatch KB-Intent, obviously hehe)

Expected behavior

I should get a Answer from the bot like i tested it in the Emulator

I hope that you can help me with my problem :-) [bug]

D33TW0 avatar Nov 20 '19 14:11 D33TW0

It might not be related to the LUIS/QnA. This sample throws that message, on any unhandled exception:

OnTurnError = async (turnContext, exception) =>
            {
                // Log any leaked exception from the application.
                logger.LogError(exception, $"[OnTurnError] unhandled error : {exception.Message}");

                // Send a message to the user
                await turnContext.SendActivityAsync("The bot encounted an error or bug.");
                await turnContext.SendActivityAsync("To run this sample make sure you have the LUIS and QnA models deployed.");
                await turnContext.SendActivityAsync("To continue to run this bot, please fix the bot source code.");

Then again, it might. The first step is determining that for sure.

The best approach at this point would be to debug using Ngrok. You can debug locally, while using the channel/client that you want (not just emulator). You can enable all CLR errors to make things easier to debug: image

Also; make sure that if you have configured the bot authentication in either the appsettings.json or the app services configuration (the emulator will run fine without these if blank).

dmvtech avatar Nov 20 '19 22:11 dmvtech

Could it be that the problem appears because i deployed the services single-handedly and not from the ARM Template that is inside the tutorial? (I deployed a Web app Basic bot template v4)

Or because i want to create a bot that uses the german language?

D33TW0 avatar Nov 21 '19 15:11 D33TW0

@danieldangler - if the queries to luis and qna maker work from a REST request or browser a GET command, those two services are set up correctly - which it sounds like they are. So make sure that the app configuration settings for your bot's web app have the same settings. That is show in the Azure portal for the web app bot.

diberry avatar Nov 21 '19 16:11 diberry

@diberry AHA that was it. I have not set the variables in the config Tab in the WebAppBot.

Thank you very much!

D33TW0 avatar Nov 21 '19 17:11 D33TW0