1
votes

I created a Web app bot in Azure portal. LUIS, App service, Insights got created automatically. This is a Basic bot using SDK-V4. It got created successfully. But after it when i tried to test the bot using "Test in Web Chat" it gave the "Failed to send activity: bot returned an error". I didn't even deployed any code for the bot. PFB the screenshot of the issue below.

I just downloaded the bot source code and did some changes. It is working fine in Emulator by getting connected to LUIS. But in "Test using web chat" it is not working even with or without deployment of code. I checked the following already:

  1. Message Endpoints.
  2. MS App ID and MS App Password in App service.

Actual getting results:

In App Insights:

Message : POST to SAP_Bot-DEV failed: POST to the bot's endpoint failed with 
          HTTP status 500 POST to the bot's endpoint failed with HTTP status 
          500.
Failed Message: Microsoft.Bot.ChannelConnector.BotAPI.ThrowOnFailedStatusCode

Call Stack:

Microsoft.Bot.Schema.BotException:
   at Microsoft.Bot.ChannelConnector.BotAPI+<PostActivityToBotAsync>d__31.MoveNext (Microsoft.Bot.Base.ChannelConnector, Version=3.2.3.0, Culture=neutral, PublicKeyToken=null)
Inner exception System.Exception handled at Microsoft.Bot.ChannelConnector.BotAPI+<PostActivityToBotAsync>d__31.MoveNext:
   at Microsoft.Bot.ChannelConnector.BotAPI.ThrowOnFailedStatusCode (Microsoft.Bot.Base.ChannelConnector, Version=3.2.3.0, Culture=neutral, PublicKeyToken=null)
   at Microsoft.Bot.ChannelConnector.BotAPI+<PostActivityToBotAsync>d__31.MoveNext (Microsoft.Bot.Base.ChannelConnector, Version=3.2.3.0, Culture=neutral, PublicKeyToken=null)

In Browser:

{error: {code: "BotError", message: "Failed to send activity: bot returned an error"},…}
error: {code: "BotError", message: "Failed to send activity: bot returned an error"}

httpStatusCode: 500[In Browser][1]

[App Insights Screenshot][2]

2
It sounds like it cannot connect to your endpoint which makes me thing it was a deployment issue or has never been deployed. Does it work from the emulator if you enter the endpoint URL + App and and Pass from Azure? I would try downloading the bot source code then running the deployment script again. There should be a Deployment/Scripts folder with a template-with-preexisting-rg.json file in it. The instructions are here.Matt Stannett

2 Answers

0
votes

Try publishing your bot and check if the messaging endpoint url is not set to localhost but to your published url in azure and in registration portalset your messaging endpoint as the redirect url

0
votes

The issue got resolved. Initially we created the MS application ID and password manually by creating an application in azure portal. There was some issue with the manually created ID, then we tried with automatic app ID creation (after getting required authorization in azure portal) and it works. Thank you all for your support.