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

fix: issue of prompt enhancer not working in prod mode #1499

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

akashMishraX
Copy link

@akashMishraX akashMishraX commented Mar 11, 2025

For issue #1448, this is my PR.

Issue Found:

The enhanced prompt was working in development mode because Node.js can handle a text stream. However, in production (Cloudflare Workers environment), it was failing.

Main Error:

The error "This ReadableStream did not return bytes" occurred because Cloudflare Workers expect a byte-based ReadableStream (e.g., Uint8Array). If _streamText (in stream-text.ts) returns a text-based stream or a different format, it fails in workerd.

Solution:

I updated api.enhancer.ts by implementing returnStream, which creates a new byte-based ReadableStream and returns it as the API response. I tested this fix in production mode, and it is now working correctly.

Thank you for reading!

Screenshot from 2025-03-11 17-44-47

@akashMishraX akashMishraX changed the title Fix: Issue of prompt enhancer not working in prod mode. fix: Issue of prompt enhancer not working in prod mode. Mar 11, 2025
@akashMishraX akashMishraX changed the title fix: Issue of prompt enhancer not working in prod mode. fix: issue of prompt enhancer not working in prod mode Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant