Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] $.respond() with readable stream in the body are not being sent as readable stream #8565

Closed
parisetflorian opened this issue Oct 23, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@parisetflorian
Copy link

According to the documentation, $.respond() is supposed to be able to handle readable streams.

Sadly, the implementation seems broken, and the respond() wait for the entire stream to be cached before sending the response. This is despite the response's body including "body_streamed:true".

Screenshot 2023-10-23 at 14 04 10

Here is my test workflow where you can reproduce the issue with :
https://pipedream.com/@insiderisk/projects/proj_zNsZnR/getaudio-p_13Claj9/inspect

Send a POST request to the endpoint with
body = {
"html" : "Sam Harris is the author of five New York Times best sellers. His books include The End of Faith, Letter to a Christian Nation, The Moral Landscape, Free Will, Lying, Waking Up, and Islam and the Future of Tolerance (with Maajid Nawaz)."
}

You'll see that the audio is sent by the workflow only once the original stream from ElevenLab has been fully received.
The desired behaviour would be to start streaming as soon as the readable streams is passed to $.respond().

And here is the related part of the documentation:
The value of the body property can be either a string, object, a Buffer
(opens new window)
(binary data), or a Readable stream
(opens new window)
. Attempting to return any other data may yield an error.

In the case where you return a Readable stream:
You must await the $.respond function (await $.respond({ ... })
The stream must close and be finished reading within your workflow execution timeout.
You cannot return a Readable and use the immediate: true property of $.respond.
You can Copy this example workflow
(opens new window)
and make an HTTP request to its endpoint URL to experiment with this.

Also, note that the link of the workflow mentioned in the documentation is broken.

@parisetflorian parisetflorian added the bug Something isn't working label Oct 23, 2023
@vunguyenhung
Copy link
Collaborator

Hi @parisetflorian, would you mind sharing the steps in your workflow in more detail? Or could you create a shared link of your workflow so that we can copy it?

@vunguyenhung vunguyenhung added the question Further information is requested label Oct 24, 2023
@theartpiece
Copy link

Hi

We're students at UT Austin looking for an issue to work on for our course project. We are interested in this issue and aim to raise PR and get it approved within a month. We will appreciate your help.

Regards

@dylburger dylburger reopened this Nov 25, 2023
@dylburger dylburger removed the question Further information is requested label Nov 25, 2023
@dylburger
Copy link
Contributor

@parisetflorian The body param can take a Readable stream, but it doesn't stream the response back to the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants