Discussions

Ask a Question
Back to all

Heygen Avatar Starts and streamReady Fires, But Still Stuck on "Waiting for Response"

Sometimes, Heygen gets stuck during the connection process. It emits the heygen_ready event, but I don’t receive a success message from the server — it keeps waiting for a response.

As a result, I'm unable to log on my end that the connection has been successfully established.

Additionally, when I try to disconnect using avatar.stop(), it throws an error stating: "You're facing some error." (or similar).

Is there a way to handle or resolve this issue more reliably?

🔄 my Current Flow (with annotations):

  1. ✅ await avatar.createStartAvatar() → Waiting for resolution

    • This is async and expected to resolve after full streaming setup, not immediately after connection starts.
  2. ✅ Connection is established under the hood (e.g., WebSocket connects)

    • But createStartAvatar() is still pending because it's waiting for internal confirmation (likely from STREAM_READY or a backend ACK).
  3. ✅ Event StreamingEvents.STREAM_READY fires

    • This should ideally resolve the createStartAvatar() call.
    • But it doesn’t, so your app stays stuck in the await state.
  4. ❌ You call avatar.stop() while createStartAvatar() is still pending

    • This interrupts the async flow and causes the pending await to throw an error like “you are facing some error” (because the avatar got stopped mid-process).

above is my code logic.

I’m working on a custom project (not using the Next.js demo) based on the Heygen documentation. Here's a quick overview of my setup:

Framework: React (with TypeScript – .tsx files)

Heygen Package: @heygen/streaming-avatar version ^2.0.11

Project Type: Fully custom implementation – not using the official Next.js demo

I'm implementing my own logic based on the official docs and integrating the avatar streaming feature successfully.