[Python] ConnectionResetError when sending messages to MS Teams Bot after inactivity period

Discussão em 'Python' iniciado por Stack, Maio 9, 2025.

  1. Stack

    Stack Membro Participativo

    While developing a bot for Microsoft Teams using Python, based on the official Microsoft sample code from Microsoft-Teams-Samples/samples/app-hello-world.

    The bot works initially and can receive and respond to messages. However, if there's an idle period of 2 minutes between messages, the connection drops and I receive the following error:


    ConnectionError(ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')))

    ClientRequestError from msrest.exceptions



    Sending another message right after it works correctly.

    What I've Tried

    • Confirmed the issue occurs consistently after 2 minutes of inactivity. (bot-conversation-quickstart)

    [​IMG]


    • The issue reproduces in production (though with another bot on a remote server).


    • The issue is consistent in production on a remote server. Could be related to proxy keep-alive configs, but I could be wrong.


    • Tried the same scenario from csharp examples and couldn't reproduce the issue. Didn't test it in production, though.

    I suspect this might be related to Bot Framework SDK in python, but I need guidance on how to properly address this issue.

    Any help or insights would be greatly appreciated!

    Continue reading...

Compartilhe esta Página