microsoft / BotFramework-Composer

Dialog creation and management for Microsoft Bot Framework Applications
https://docs.microsoft.com/en-us/composer/
MIT License
867 stars 367 forks source link

Bot published in Azure App Service don't work, locally with emulator it's fine #8743

Open samuelrc-test opened 2 years ago

samuelrc-test commented 2 years ago

Describe the bug

I've been working with bot framework composer since a year and a half ago. I have a chatbot published in Azure since october 2020 that was created with composer 1.2 and since june of this year we started to develop a totally new version of our chatbot in Composer 2.0. Now we are working with Bot Composer 2.1.1 and everything was fine until we published the chatbot in azure. we tried with existing components and new components, in my corporate subscription and in my personal subscription and the result is the same: the chatbot works fine locally but after published in azure don't work in webchat either in directline. For example the greeting message have two messages, but in webchat just show one, just the first one (image 1, 2 and 3); locally it uses Luis and QnA fine but in webchat or directline fails, as I describe in images 4,5,6,7.

Version

Version: 2.1.1 Electron: 8.2.4 Chrome: 80.0.3987.165 NodeJS: 12.13.0 V8: 8.0.426.27-electron.0

Browser

OS

To Reproduce

Steps to reproduce the behavior:

  1. Create a Bot in Composer 2.1.1'...'
  2. Deploy bot in Azure '....'
  3. Test the bot locally (works fine) '....'
  4. Test the bot in Webchat (error, don't work)

Screenshots

Image 1 Greeting Dialog Design GreetingDialogDesign

Image 2 Greeting Test In Emulator Locally GreetingTestInEmulatorLocally

Image 3 Greeting Test In Webchat GreetingTestInWebchat

Image 4 QnA Test Emulator Locally QnATestEmulatorLocally

Image 5 QnA Test In Webchat QnATestInWebchat

Image 6 Luis Test Emulator Locally LuisTestEmulatorLocally

Image 7 Luis Test In Webchat LuisTestInWebchat

thanks for your help Samuel R.

dkay2017 commented 2 years ago

Hi , I have encountered similar issue , when publishing the sample weather bot . locally it works but after publishing it doesnt respond.

Regards Deepak

tonyanziano commented 2 years ago

Hi @samuelrc-test ,

Can you please go to the "Channels" blade of your published bot in Azure, and go to the Web Chat channel and see if there are any network errors that you can look at?

It seems very strange that even for the greeting you are only getting one out of the two responses, when it looks like all they do is just send some text back.

samuelrc-test commented 2 years ago

Hello, thanks for your attention, in channels blade everything is fine, attach the image I don't know what is it the issue

channelStatus

dmvtech commented 2 years ago

@samuelrc-test If you use Emulator and use the published/public endpoint in Azure instead of localhost (as well as the appropriate appid/password); does that behave the same? Was there any issues with publishing? You have re-published and it still persists?

samuelrc-test commented 2 years ago

Hello @dmvtech in the emulator using the published endpoint with the appropiate appid and password works fine!!! look the image. Any problem publishing? Yes, after create de resources I saw a few errors with luis app and endpoint of authoring, but finally I resolved them and I did 3 correct deployments without errors. yes, I have republished 3 times and still getting the same error EmulatorTesttoAzureBot Look that the greeting it's correct but in webchat, fails thanks for your help

samuelrc-test commented 2 years ago

Hello, yesterday showed this error in Channels tab, but I don't have datails. channelStatusError

samuelrc-test commented 2 years ago

Good morning: I think that the problem is between the version 2.x of composer and the last version of Azure bot component, it was named bot channel registration. yesterday I published another chatbot, with main locale in "es-mx", it published fine. If I run the bot local or in emulator to the app id in Azure, works fine but when I try by azure webchat, the bot greeting in english, ignoring de main locale "es-mx". I don't know if it will be a new version of composer or the Azure Bot service that fix this errors. by now I can't publish new chatbots because all fail.

tonyanziano commented 2 years ago

Hello @samuelrc-test ,

I'm having trouble understanding what errors you are having now.

It sounds like:

  1. You can publish the bot with locale of es-mx and it works
  2. You can talk to the bot locally and remotely (using the app id + password) via the Emulator and it works
  3. You can talk to the bot via the Azure portal, but the bot responds in English

Is all this information correct? If so, what do you mean by "I can't publish new chatbots because all fail?" Are you seeing errors in Composer during the publish? Or are you just talking about how the published bot is responding in English instead of the desired locale of es-mx?

If you were able to talk to the bot via Emulator remotely, using the URL and App ID + password, then you were talking to the published bot, and if it was responding in es-mx then it is working as expected.

I think the problem might be that your language isn't set properly inside of the Azure Portal, and so Web Chat is using the default locale of en-us when communicating with your bot.

samuelrc-test commented 2 years ago

Thanks for your response @tonyanziano. It's correct your understanding, both chatbots of this thread deploy correctly in azure, the problem is when I try to connect them through webchat, directline or MS teams, in all this scenarios both chatbots fail. The only one scenario where chatbots don't fail is where I connect to the chatbots from emulator with the appId and the password. When I say that "I can't publish new chatbots because all fail?" I'm meaning that the fact that when I publish a chatbot I can't use it from any channel because it fails. The first one chatbot don't show all messages, don't use Luis and Qna and the second responds in a wrong locale. no one of this issues showed in the past with earlier versions of Composer and the earlier versions of Channel bot registration. In the past versions the chatbots didn't fail.

tonyanziano commented 2 years ago

I see, so there isn't actually anything wrong with the publishing process, it's more the fact that the published bots aren't working properly when you try to contact them.

I do find it very odd that you can connect to the published bots via Emulator, but you cannot talk to them using Teams or Web Chat.

Can you try changing your language / region settings in Azure to use the correct locale and then try talking to the bot using Web Chat?

image

samuelrc-test commented 2 years ago

I've changed the locale and the language in azure portal and even in the browser, everything is in spanish and the test fails again, the bot just answer in english IssuewithLocale

samuelrc-test commented 2 years ago

I think I found the problem!!! In this post I am talking about two chatbots, the first one have two messages in the greeting but just show the first one and the second chatbot speak in english even I've created it in spanish. ok it seems that the problem is the same, the default language and the locale. In the emulator and in local environment I can choose the locale and the chatbot speaks good but in webchat and the DirectLine channel I can't do that. Even if I change the azure language and browser language the issue still happen. So, the question is: how can I configure the language and the locale of my chatbot for always answer in spanish??

tonyanziano commented 2 years ago

Hi @samuelrc-test ,

That's what I was thinking as well -- that the outgoing locale is the problem.

When communicating with your bot via Direct Line (raw HTTP requests), you can specify the locale in the body of the activity:

POST https://directline.botframework.com/v3/directline/conversations/abc123/activities
Authorization: Bearer RCurR_XV9ZA.cwA.BKA.iaJrC8xpy8qbOF5xnR2vtCX7CZj0LdjAPGfiCpg4Fv0
Content-Type: application/json

{
    "locale": "en-EN",
    "type": "message",
    "from": {
        "id": "user1"
    },
    "text": "hello"
}

If you inspect any outgoing message in Emulator, you will see that it sends the locale that you specify in the settings:

image

image

When rendering Web Chat on a custom website or web app, you can specify locale via a prop to the <ReactWebChat /> component or as an argument to the renderWebChat() method.

<ReactWebChat locale={'en-GB'} />

window.webchat.renderWebChat({ locale: 'en-GB' })

===

For testing the bot in the Azure portal, my understanding is that Web Chat should take the locale from your Azure settings and use it to communicate with the bot, but it seems like that is not working in your case.

@compulim maybe you can add some more insight on that.