Azure Bot Web Chat Working but Teams channel not hitting messaging endpoint

Tyler Faulkner 5 Reputation points
2024-03-01T20:57:58.7233333+00:00

I have created a bot for a client and I am in the process of moving everything over to their environment.

The architecture is an Azure Web App hosting a Node server using Bot Framework SDK, an Azure Bot pointing at the /api/messages endpoint on the server, and a teams channel open on the Azure bot.

I have got the app setup and can communicate to it using the web chat in the Azure Bot web portal; however, when I try to use the direct teams link or a custom app to communicate with the bot I got no response. I can see the messages are reaching the bot since the requests count are increasing in the analytics. The Azure Bot is not forwarding the messages to the web app however. The Entra App for the Azure bot is set to multi-tenant. Any help would be greatly appreciated. I am willing to provide more info as necessary.

I have looked at the network requests in web teams and noticed the message was getting a 403 with the response having a 209 error stating something along the line of “Writes blocked on this thread”.

Microsoft Teams | Development
Microsoft Teams | Development
Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. ChetanSharmamsft 1,036 Reputation points Microsoft External Staff Moderator
    2024-03-02T09:08:02.71+00:00

    Hello @Tyler Faulkner - There may be some issue because of following reasons:

    Asynchronous Operations: Ensure that your bot code is performing asynchronous operations properly. If your bot is making network calls, accessing external services, or performing long-running tasks, use asynchronous patterns such as async/await to avoid blocking the thread.

    Blocking Calls: Avoid making blocking calls within the bot's message handlers or event handlers. Blocking calls can cause the bot's execution thread to be blocked, leading to performance issues and potential errors. Instead, use non-blocking patterns and asynchronous APIs wherever possible.

    Concurrency Issues: Review your bot's concurrency model and ensure that it's designed to handle concurrent requests and messages effectively. Use thread-safe data structures and synchronization mechanisms to prevent race conditions and data corruption.

    **
    External Dependencies**: If your bot relies on external services or resources, ensure that these dependencies are accessible and responsive. Handle timeouts, retries, and error conditions gracefully to prevent the bot from getting stuck in a blocked state.


  2. Tyler Faulkner 5 Reputation points
    2024-03-05T22:27:42.86+00:00

    I am not sure what the issue was but if anyone else comes across this strange behavior try creating a new Azure Bot from scratch. Creating a new bot with the same settings fixed it for me. The only difference is I had a tenant admin add the Teams channel to the app instead of doing it my self (my account only had contributor access on the specific resource).

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.