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

Web App Bot cant insert records in the Azure Table Storage

Open D33TW0 opened this issue 5 years ago • 6 comments

Version

Microsoft Bot Framework SDK 4.0

Describe the bug

I implemented a new feature to write user messages to the Azure Table Storage. When I test the bot locally, everything works as planned. If I upload the code to an Azure Web App Bot and test it in Azure, the bot does not write anything to the storage. But why?

To Reproduce

  1. Build a web app bot inside Azure (I used this: https://docs.microsoft.com/de-de/azure/bot-service/bot-builder-tutorial-dispatch?view=azure-bot-service-4.0&tabs=cs)
  2. Create a storage account with a table
  3. Publish the code to the web app bot and write things like "dtezezetdf" or "252632375" (For the table storage code i used this tutorial: https://www.programmingwithwolfgang.com/implement-azure-storage-tables-queues-and-azure-cosmos-db-table-api/)
  4. check if the bot writes things in the table storage

Expected behavior

The Web App Bot should write messages that the bot cant handle in the table storage storage.

Screenshots

m1 Here i save my credentials for the storage account

m2 There is the placeholder for the user message

m3 This is the method i execute when the bot cant handle the message from the user

m4

d1 d2 These are the outputs from my App Insights. As i said earlier everything works, when i try to execute and test the code locally with VS and the bot framework emulator. This error only appears online inside the web app bot.

If i need to add more informations feel free to ask for that.

Tracking Status

Dotnet SDK TODO

  • [ ] PR
  • [ ] Merged

Javascript SDK TODO

  • [ ] PR
  • [ ] Merged

Python SDK TODO

  • [ ] PR
  • [ ] Merged

Java SDK TODO

  • [ ] PR
  • [ ] Merged

Samples TODO

  • [ ] PR
  • [ ] Merged

Docs TODO

  • [ ] PR
  • [ ] Merged

Tools TODO

  • [ ] PR
  • [ ] Merged

D33TW0 avatar Dec 02 '20 23:12 D33TW0

Hi @stevkan, any update?

hcyang avatar Dec 06 '20 19:12 hcyang

Hi @danieldangler, can you verify that you are including the table storage credentials in your app service configuration?

stevkan avatar Dec 08 '20 19:12 stevkan

Hey @stevkan , the credentials are at the moment hardcoded in my GetTableReference() method, (first screenshot, i have changed the credentials with the placeholders "CONNECTION STRING" and "TABLE NAME"). Do i need them also in the App Service configuration?

Thanks for your time!

D33TW0 avatar Dec 08 '20 19:12 D33TW0

@danieldangler, hard-coding the creds should be fine, though I'd argue placing them in the app service configuration is a better option (but that is another topic).

How are you publishing your bot? Are you doing so thru Visual Studio? If so, there is an option you can select that tells the service to remove/delete all files before deploying the new files. I'm not confident that this is the issue, but it is worth trying while I suss this out a bit more.

stevkan avatar Dec 11 '20 18:12 stevkan

@stevkan i used two methods to publish the code:

  1. I have tried to publish the code via azure pipelines
  2. I have tried to publish the code via Visual Studio

i just tried if the publishing process in visual studio works if you delete all files in the app service but unfortunately without success

D33TW0 avatar Dec 14 '20 10:12 D33TW0

@danieldangler, thank you for your patience. I'm going to ask that you post this on Stack Overflow as this really is a "how-to" question in which you are trying to roll your own storage solution for logging user activity. The official Bot Framework Github repo is the preferred platform for information on submitting bug fixes and feature requests.

That being said, if you post the question on Stack Overflow I can continue to offer guidance in that forum. Be sure to apply the botframework tag to your question as we try to monitor Stack Overflow for submitted questions. As long as you do that, it will be visible to my team. You also have the added benefit of a wider community available to offer help.

Please consider updating your question when you re-post with responses to the following as they will help in understanding the overall issue.

  • Where in the bot lifecycle are you implementing/calling your methods?
  • Have you tried assigning your table storage credentials as singletons in startup.cs?
  • In the second attached image, you call TableOperation.insert()...where is that coming from?
  • It looks like NoMatchFound() is part of a dialog waterfall. Is this correct? What is happening before/after this step. What leads to it?
  • You say this works locally. What happens if you run local but trying tunneling to your ABS bot registration using ngrok (replacing the messaging endpoint with the ngrok url + /api/messages) and then run using Test in Web Chat?

stevkan avatar Dec 23 '20 01:12 stevkan