Skip to content

Binary stream chunks not yielded in async iterator for non-event-stream responses #158

@actuallyzefe

Description

@actuallyzefe

Binary stream chunks not yielded in async iterator for non-event-stream responses

Bug Description

When using fal.stream() with endpoints that return binary data (e.g., audio/video streams), the async iterator does not yield any chunks even though the stream completes successfully. This affects endpoints like ElevenLabs TTS and any other endpoint that returns non-text/event-stream content types.

Repro

import { fal } from "@fal-ai/client";

const stream = await fal.stream("fal-ai/elevenlabs/tts/turbo-v2.5", {
  input: {
    text: "Hello! This is a test of the text to speech system.",
  },
});

let eventCount = 0;
for await (const event of stream) {
  eventCount++;
  console.log("Event:", event);
}

const result = await stream.done();
console.log("Total events received:", eventCount); // Output: 0 
console.log("Final result:", result); // Output: Uint8Array(713) [...]

Expected behavior: Should receive multiple chunks (e.g., 36 audio chunks)
Actual behavior: Receives 0 chunks, but stream.done() returns the final chunk

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions