You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.
I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.14.1
Plugin version
2.1.0
Node.js version
16.x
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
NA
Description
When the request encounters and error and that error is passed to the callback it is possible to get into a scenario where the response attempts to write after it has already been sent because res.sent is undefined. This results in an uncaught exception [ERR_STREAM_WRITE_AFTER_END]: write after end to be thrown if a response has already been sent.
Looking at the type of res argument (http.ServerResponse) there isn't an attribute called sent so it seems like this we will always get into this conditional here .
Steps to Reproduce
Unsure of how to replicate this.
Expected Behavior
A check to see if all writeable data has been flushed in order to get into this conditional. Perhaps checking response.writeableFinished
The text was updated successfully, but these errors were encountered:
jcbain
added a commit
to TugboatQA/fast-proxy
that referenced
this issue
Apr 18, 2023
)
* fix: prevent response from being sent if all res headers have been flushed (#86)
* test: add test to assert that a response is not resent after res headers have been flushed (#86)
* fix: remove whitespace
* docs: add comment to err conditional in request callback
* fix: perform explicit check on response attributes
Co-authored-by: James Sansbury <[email protected]>
* fix linting errors
---------
Co-authored-by: James Sansbury <[email protected]>
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Prerequisites
Fastify version
4.14.1
Plugin version
2.1.0
Node.js version
16.x
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
NA
Description
When the
request
encounters and error and that error is passed to the callback it is possible to get into a scenario where the response attempts to write after it has already been sent becauseres.sent
isundefined
. This results in an uncaught exception[ERR_STREAM_WRITE_AFTER_END]: write after end
to be thrown if a response has already been sent.Looking at the type of
res
argument (http.ServerResponse
) there isn't an attribute calledsent
so it seems like this we will always get into this conditional here .Steps to Reproduce
Unsure of how to replicate this.
Expected Behavior
A check to see if all writeable data has been flushed in order to get into this conditional. Perhaps checking
response.writeableFinished
The text was updated successfully, but these errors were encountered: