BotFramework-Emulator icon indicating copy to clipboard operation
BotFramework-Emulator copied to clipboard

Unexpected bot behavior after deploying to Azure (Bot emulator works without APP Id - Password and "failed [500] Internal Server Error" with it

Open iamthewall opened this issue 9 years ago • 7 comments

Hi experts,

We have been developing a bot using some samples and the Bot Framework SDK on VS2015. The Bot is conformed by different VS projects based on some design principles that we define

  1. When we test the bot on the Bot Framework Emulator LOCALLY it works fine

  2. After the bot deployment on Azure (http://botmsar.azurewebsites.net/api/messages) the Bot Acknowledges the connection but after the first post, it throw a [500] Internal server error message [19:06:59] -> POST 200 [conversationUpdate]
    [19:06:59] -> POST 200 [conversationUpdate]
    [19:07:03] -> POST Request to 'http://botmsar.azurewebsites.net/api/messages' failed: [500] Internal Server Error capture

  3. We notice that if we try to connect to the bot using just the URL without the ID and password it works. image

  4. Even that it is working without those parameters, we think that it won't be working correctly on other apps, since it also throws an error on the bot framework test option and since it is not working on skype channel. image

I hope you can guide me on what's going on. If you need the source code, please let me know.

iamthewall avatar Oct 02 '17 19:10 iamthewall

The 500 is coming from your bot. Can you log errors in your bot to see what the error is? I suspect it may be that you need to add a call to TrustServiceUrl. See https://github.com/Microsoft/BotBuilder/issues/3329#issuecomment-322570247

danmarshall avatar Oct 02 '17 19:10 danmarshall

A deployed bot that has no appid or password will still function with the emulator. Have the MicrosoftAppId and MicrosoftAppPassword been set in the web.config? (for a .net sdk bot) Or, you can also supply these in Azure's App Settings.

EricDahlvang avatar Oct 02 '17 23:10 EricDahlvang

@EricDahlvang I have tried both ways and the error persist. It seems it is more related with the thread suggested by @danmarshall . Could you please provide me more insights of why the TrustServiceUrl os required? Thanks

iamthewall avatar Oct 03 '17 02:10 iamthewall

@iamthewall TrustServiceUrl is part of Bot Authentication in the .net sdk. MicrosoftAppCredentials only sets the Authorization header when the ServiceUrl is trusted, and the ServiceUrl is only considered to be trusted when it is in the TrustedHostNames: https://github.com/Microsoft/BotBuilder/blob/e133266e9754b3f0bd8b992e078237ee7bcb963a/CSharp/Library/Microsoft.Bot.Connector.Shared/MicrosoftAppCredentials.cs#L157 The ServiceUrl is added to the TrustedHostNames when the BotAuthenticator has validated the token: https://github.com/Microsoft/BotBuilder/blob/719a89e0a74c1114a4c82ccf77c8c8ae09af3ed7/CSharp/Library/Microsoft.Bot.Connector.Shared/BotAuthenticator.cs Or, when the developer specifically calls TrustServiceUrl.

EricDahlvang avatar Oct 03 '17 19:10 EricDahlvang

@EricDahlvang Hi Eric, I am trying to build a bot and log the conversation to my Azure SQL DB. I have followed the steps on https://blog.botframework.com/2017/05/05/Saving-Bot-Actions-On-Azure-Sql-Server/

I am getting an error of Request to 'https://botapplicationsqlexample.azurewebsites.net/api/messages' failed: [500] Internal Server Error . The conversation is getting stored on the DB but no reply from the Bot's end is coming, rather 500 error is being shown. Could you please help me with it?

Muskan-14 avatar Feb 22 '18 10:02 Muskan-14

Hi @Muskan-14

I'm sorry you've run into issues with the blog post. Please try running the bot locally, and debugging the code using the emulator. This document explains how to setup the emulator for local debugging: https://docs.microsoft.com/en-us/bot-framework/bot-service-debug-emulator


This repository is for issues with the BotFramework-Emulator. If you require further assistance, please ask your question on StackOverflow with the BotFramework tag, or the BotBuilder GitHub repository.

EricDahlvang avatar Feb 22 '18 18:02 EricDahlvang

Closing this issue due to age and no activity.

EricDahlvang avatar Feb 22 '18 18:02 EricDahlvang