-
-
Notifications
You must be signed in to change notification settings - Fork 579
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
ERR_STREAM_PREMATURE_CLOSE #1253
Comments
Hi @LebCit , thanks for reporting. I've noticed the error you mentioned, but I believe it's already been fixed. Does this error occur consistently? If possible, could you share the piece of code or a snippet that triggers this bug? |
Hello @yusukebe I've updated today Hono from 3.3.2 to 3.3.3 and the error still occurs. Regarding the code, the project is in the following GitHub repository: https://github.com/LebCit/blog-doc I've just seen that you've starred it, thank you very much for your support. |
Hi @LebCit Thank you for sharing this. While this doesn't directly concern Hono core, it pertains to |
@LebCit Hi, I downloaded your codes, and use node 18.17.0 / hono 3.3.3 / node-server 1.1.0. But I couldn't reproduce your issues. So could you provide us some more detailed reproduction steps? |
Hello @yusukebe @tangye1234 Thanks again both for your time, efforts and starring Blog-Doc. Another weird behavior is that if you stay about a minute on a page like Documentation without touching the app, the I've just opened the app from 7pm52 til 8pm04 played around a little bit leaved the app and this is the console: {} # This is the entry route
{ folder: 'pages', filename: 'documentation' }
# The { folder: 'rss' } was here but it disappeared!
{ folder: 'admin' }
{ folder: 'admin' }
{ folder: 'icons', filename: 'favicon.ico' }
{ folder: 'posts' }
{ folder: 'tags' }
{ folder: 'tags', tag: 'Archive', filename: 'Archive' }
{ folder: 'search' }
{ folder: 'pages', filename: 'documentation' }
{ folder: 'admin' }
{ folder: 'icons', filename: 'favicon.ico' }
{ folder: 'admin' }
{ folder: 'icons', filename: 'favicon.ico' }
{ folder: 'admin' }
{ folder: 'admin-config-site' }
{ folder: 'admin-config-menu' }
{} # This is the entry route
{ folder: 'pages', filename: 'documentation' }
{} # This is the entry route
Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
at new NodeError (node:internal/errors:405:5)
at ServerResponse.onclose (node:internal/streams/end-of-stream:154:30)
at ServerResponse.emit (node:events:526:35)
at emitCloseNT (node:_http_server:996:10)
at Socket.onServerResponseClose (node:_http_server:278:5)
at Socket.emit (node:events:526:35)
at TCP.<anonymous> (node:net:323:12) {
code: 'ERR_STREAM_PREMATURE_CLOSE'
}
{ folder: 'posts', filename: 'the-new-blog-doc' } While editing the last code and leaved the app on without touching it then came back at 8pm18 and clicked a few route this is the console: {}
{ folder: 'pages', filename: 'documentation' }
{ folder: 'admin' }
{ folder: 'admin' }
{ folder: 'icons', filename: 'favicon.ico' }
{ folder: 'posts' }
{ folder: 'tags' }
{ folder: 'tags', tag: 'Archive', filename: 'Archive' }
{ folder: 'search' }
{ folder: 'pages', filename: 'documentation' }
{ folder: 'admin' }
{ folder: 'icons', filename: 'favicon.ico' }
{ folder: 'admin' }
{ folder: 'icons', filename: 'favicon.ico' }
{ folder: 'admin' }
{ folder: 'admin-config-site' }
{ folder: 'admin-config-menu' }
{}
{ folder: 'pages', filename: 'documentation' }
{}
Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
at new NodeError (node:internal/errors:405:5)
at ServerResponse.onclose (node:internal/streams/end-of-stream:154:30)
at ServerResponse.emit (node:events:526:35)
at emitCloseNT (node:_http_server:996:10)
at Socket.onServerResponseClose (node:_http_server:278:5)
at Socket.emit (node:events:526:35)
at TCP.<anonymous> (node:net:323:12) {
code: 'ERR_STREAM_PREMATURE_CLOSE'
}
{ folder: 'posts', filename: 'the-new-blog-doc' }
{ folder: 'posts' }
Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
at new NodeError (node:internal/errors:405:5)
at ServerResponse.onclose (node:internal/streams/end-of-stream:154:30)
at ServerResponse.emit (node:events:526:35)
at emitCloseNT (node:_http_server:996:10)
at Socket.onServerResponseClose (node:_http_server:278:5)
at Socket.emit (node:events:526:35)
at TCP.<anonymous> (node:net:323:12) {
code: 'ERR_STREAM_PREMATURE_CLOSE'
}
{ folder: 'posts', filename: 'the-new-blog-doc' }
Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
at new NodeError (node:internal/errors:405:5)
at ServerResponse.onclose (node:internal/streams/end-of-stream:154:30)
at ServerResponse.emit (node:events:526:35)
at emitCloseNT (node:_http_server:996:10)
at Socket.onServerResponseClose (node:_http_server:278:5)
at Socket.emit (node:events:526:35)
at TCP.<anonymous> (node:net:323:12) {
code: 'ERR_STREAM_PREMATURE_CLOSE'
}
{ folder: 'admin' }
Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
at new NodeError (node:internal/errors:405:5)
at ServerResponse.onclose (node:internal/streams/end-of-stream:154:30)
at ServerResponse.emit (node:events:526:35)
at emitCloseNT (node:_http_server:996:10)
at Socket.onServerResponseClose (node:_http_server:278:5)
at Socket.emit (node:events:526:35)
at TCP.<anonymous> (node:net:323:12) {
code: 'ERR_STREAM_PREMATURE_CLOSE'
} |
This error is actually a normal tcp termination error. Usually we don't need to pay attention to it. If it really bothers, I can filter this error in node server, or just ignore the error stack. The latter thing is exactly what nextjs or express dose. |
Hi @tangye1234 Thanks for investigating! Ignoring the error stack in the node server is good for me. Can you create the issue? |
Hey @tangye1234 ! I too am facing this problem now. I want to make it ignores the error, to do so, do I make it does nothing in the |
yes, just don’t print console error, and PR is welcome. The error may be thrown either from down stream in nodejs server response or from upstream in hono stream. The premature error is thrown from nodejs down stream when user abort a http request. Most frameworks just print error message instead of error stack. Nuxt / Next do not swallow this error, but only print message instead. |
Thanks for the explanation, would be great if you could make PR! |
I think neither The error thrown from the pipeline for kinds of situation:
The annoying stacktrace is carried by the We can just test the error info, if it is @yusukebe Hope you could do the test and PR. As for now, I am in a very hurry leading project and have barely time for verifying that. Thanks 👍 |
Thanks for the detailed explanation despite you are busy . I've corrected the PR honojs/node-server#83. Please take a look if you like. |
This was closed by honojs/node-server#83. Thanks! |
Hello,
I'm using Node.js Version 18.17.0
I've updated today :
When I start my app I'm getting the following error:
The app continues to work but once in a while this error pops up without stopping the app.
The text was updated successfully, but these errors were encountered: