-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Accidental breaking change on v15.7.0 #37705
Comments
cc/ @nodejs/web-server-frameworks |
The change in nodejs#36505 broke userland code that already wrote to res.req. This commit updates the res.req property in the http2 compat layer to be a normal property. Fixes: nodejs#37705
@mmarchini do you think this is just an unfortunate breakage because due the popularity of the |
I think so, yes. It's very easy to support backward compatible behavior anyway. |
I agree with @mcollina, it's easy enough to ensure backward compatible behavior that we should avoid breaking it whenever possible. |
I'm +1 for treating it as semver major since if someone is currently assigning to the property, making it readonly will break their code |
The change in #36505 broke userland code that already wrote to res.req. This commit updates the res.req property in the http2 compat layer to be a normal property. PR-URL: #37706 Fixes: #37705 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Mary Marchini <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
The change in #36505 broke userland code that already wrote to res.req. This commit updates the res.req property in the http2 compat layer to be a normal property. PR-URL: #37706 Fixes: #37705 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Mary Marchini <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
What steps will reproduce the bug?
This issue was introduced on #36505
Try to assign something to
req
on an instance ofHttp2ServerResponse
.Example error: https://github.com/restify/node-restify/runs/2081960519?check_suite_focus=true#step:5:242
Example code: https://github.com/restify/node-restify/blob/master/lib/server.js#L1282
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior?
The code should not break on a
semver-minor
What do you see instead?
An error is thrown
Additional information
This happens because getters are not assignable on strict mode. We can't revert the change because that would also be a breaking change, so we have two options:
getter
to a normal property, so that user code doesn't break. We can go back to a getter onv16
If we go with the latter we might want to discuss making all properties on req/res non-assignable (which IMO is not desirable).
cc @nodejs/tsc @nodejs/http2 @nodejs/releasers
The text was updated successfully, but these errors were encountered: