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

I need help Iam Getting this error I think its from your end? #51

Open
TEJA2312 opened this issue May 9, 2023 · 2 comments
Open

I need help Iam Getting this error I think its from your end? #51

TEJA2312 opened this issue May 9, 2023 · 2 comments

Comments

@TEJA2312
Copy link

TEJA2312 commented May 9, 2023

I am not able to stream responses to my front end. this the error Im getting:-

uncaught exception silently logged: Error: write after end at new NodeError (node:internal/errors:399:5) at write_ (node:_http_outgoing:890:11) at ServerResponse.write (node:_http_outgoing:849:15) at u.flush (/Users/tejasshirnalkar/Documents/GitHub/main_api/node_modules/better-sse/build/index.js:1:3337) at u.push (/Users/tejasshirnalkar/Documents/GitHub/main_api/node_modules/better-sse/build/index.js:1:3450) at IncomingMessage.<anonymous> (/Users/tejasshirnalkar/Documents/GitHub/main_api/src/modules/brieflyai/service/brieflyai_service.js:61:30) at IncomingMessage.emit (node:events:513:28) at IncomingMessage.emit (node:domain:489:12) at IncomingMessage.Readable.read (node:internal/streams/readable:539:10) at flow (node:internal/streams/readable:1023:34) at resume_ (node:internal/streams/readable:1004:3) at processTicksAndRejections (node:internal/process/task_queues:82:21) { code: 'ERR_STREAM_WRITE_AFTER_END' }

@TEJA2312
Copy link
Author

TEJA2312 commented May 9, 2023

Here is my full code to stream data from chatgpt:-

Screenshot 2023-05-09 at 1 54 41 PM

@flipace
Copy link
Contributor

flipace commented Sep 28, 2023

late to the party, but it appears to be an issue where your request was already ended.

depending on how you handle the requests, you might have to explicitly state that you don't want to send a "final" response and use your own response handling.

for example, when using koa you'd have to set ctx.respond = false because otherwise koa would already handle the response and thus it's no longer possible to send any data to that client since the connection closes.

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

No branches or pull requests

2 participants