Discussions
activityIdleTimeout not being respected & stream disconnected
Hello I am currently using the @heygen/streaming-avatar": "^2.0.16 and with this I am using the prop activityIdleTimeout: 300 instead of disableIdleTimeout: false which is deprecated, but this value is not being preserved.
From my logs, the avatar spoke a long message beginning with “How about...” at 11:58:25 and finished at 11:58:48 — a total of 23 seconds. The corresponding events (avatar_talking_message, avatar_end_message, avatar_stop_talking, and stream_disconnected) confirm this. But just 2 seconds after the avatar finished talking, I received a stream_disconnected event from the SDK. This should not have happened, as the activityIdleTimeout was set to 300 seconds.
This issue is occurring consistently and is causing significant problems — the stream disconnects unexpectedly, even when we're actively sending text for the avatar to speak. This breaks the flow of the app, and the timeout behavior does not seem to match the configured value.
Previously, I was using version ^2.0.7 with disableIdleTimeout: false, and I was experiencing the same behavior. This leads me to believe the idle timeout may not be working as intended, or the calculation logic behind it is flawed.
In other cases, I’ve experienced behavior similar to what’s described in this thread: https://docs.heygen.com/discuss/683d6a50ed8afc00129e350a.
How can I prevent the stream from disconnecting prematurely? Is there a workaround or fix available?
Thanks in advance for your help.
*Note: I am using the paid plan
app.js:2 2025-06-23 11:58:25,645|DEBUG|MINIAPP|HeygenAiAgent | Repeating message: How about *The Curious Case of Benjamin Button*? In this unique fantasy drama, Brad Pitt plays Benjamin Button, a man who ages in reverse. Directed by David Fincher, the film explores themes of time and life through Benjamin's extraordinary journey. Would you like more details on this movie, see the trailer, or hear another suggestion?
app.js:2 2025-06-23 11:58:25,971|DEBUG|MINIAPP|HeygenAiAgent | [Event] Avatar talking message.
app.js:2 2025-06-23 11:58:25,974|DEBUG|MINIAPP|HeygenAiAgent | [Event] Avatar end message.
app.js:2 2025-06-23 11:58:48,079|DEBUG|MINIAPP|HeygenAiAgent | [Event] Avatar stopped talking.
app.js:2 2025-06-23 12:00:11,337|DEBUG|MINIAPP|HeygenAiAgent | [Event] Stream Disconnected.
app.js:2 2025-06-23 12:00:11,337|DEBUG|MINIAPP|HeygenAiAgent | Session ended unexpectedly (e.g., HeyGen's idle timeout). Restarting mini-app.
app.js:2 2025-06-23 12:00:11,343|DEBUG|MINIAPP|HeygenAiAgent | Attempting to play the Avatar video...