Azure-Samples / gen-ai-bot-in-a-box

This template deploys a Generative AI Virtual Assistant using Azure OpenAI and Bot Framework.
MIT License
32 stars 10 forks source link

Add Teams Channel in Azure Bot -> fail to chat with the bot in Teams #10

Closed BruceEx closed 1 month ago

BruceEx commented 2 months ago

Please provide us with the following information:

This issue is for a: (mark with an x)

**- [X] bug report -> please search issues before submitting**
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

After deploy to Azure, in the bot, add Microsoft Teams channel. Then open the Teams chat, but fail to chat with the bot. The bot give following response: The bot encountered an error or bug. To continue to run this bot, please fix the bot source code. An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.

But what is the invalid URI?

Take a look on the backend app log and find the failure, but still cannot know what is the invalid URI and how it throws the exception:

2024-09-03T07:56:52.671129243Z: [INFO] fail: Microsoft.Bot.Builder.Integration.AspNet.Core.IBotFrameworkHttpAdapter[0] 2024-09-03T07:56:52.671171381Z: [INFO] [OnTurnError] unhandled error : An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set. 2024-09-03T07:56:52.671587958Z: [INFO] System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set. 2024-09-03T07:56:52.671636138Z: [INFO] at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage request) 2024-09-03T07:56:52.671644103Z: [INFO] at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) 2024-09-03T07:56:52.671650755Z: [INFO] at GenAIBot.Bots.AssistantBot1.HandleFileUploads(ITurnContext turnContext, AssistantThread thread, ConversationData conversationData, CancellationToken cancellationToken) in D:\Dev\gen-ai-bot-in-a-box\src\dotnet\Bots\AssistantBot.cs:line 240 2024-09-03T07:56:52.671657198Z: [INFO] at GenAIBot.Bots.AssistantBot1.OnMessageActivityAsync(ITurnContext1 turnContext, CancellationToken cancellationToken) in D:\Dev\gen-ai-bot-in-a-box\src\dotnet\Bots\AssistantBot.cs:line 79 2024-09-03T07:56:52.671663529Z: [INFO] at Microsoft.Bot.Builder.ActivityHandler.OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken) 2024-09-03T07:56:52.671669510Z: [INFO] at Microsoft.BotBuilderSamples.StateManagementBot1.OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken) in D:\Dev\gen-ai-bot-in-a-box\src\dotnet\Bots\StateManagementBot.cs:line 26 2024-09-03T07:56:52.671758367Z: [INFO] at Microsoft.Bot.Builder.MiddlewareSet.ReceiveActivityWithStatusAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken) 2024-09-03T07:56:52.671766903Z: [INFO] at Microsoft.Bot.Builder.BotAdapter.RunPipelineAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)

Expected/desired behavior

Teams channel should work

OS and Version?

Windows 11


Thanks! We'll be in touch soon.

BruceEx commented 2 months ago

my alias is tingya, feel free to ping me in MS teams!

MarcoABCardoso commented 2 months ago

Hi @BruceEx ! It seems that regular Teams messages are being interpreted as having attachments (even when they don't). The missing URL is the attachment download link.

I was able to reproduce and will fix this shortly. Thank you for reporting!

MarcoABCardoso commented 2 months ago

Updates were pushed to update the following behaviors on MS Teams:

@BruceEx please let me know if your issue is fixed. Thank you!

MarcoABCardoso commented 1 month ago

Closing this for now, please feel free to reopen if needed.