-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Regression in Node 17.5, Assigning a function to prototype of an Object results in a TypeError: Cannot assign to read only property 'x' of object 'y' at Object.<anonymous> #41926
Comments
According to your docs,
That conflicts with the fact that map() is now an iterator helper method for Node.js streams. But... why was that method added to Node.js core as non-writable ?? |
Maybe core-devs want to ensure that map is not overwritten for performance reasons? |
@nodejs/streams |
cc @benjamingr that was my fear this could happen. Almost every time we added properties to the streams this happened. Either we:
|
maybe 1. with a warning if one does overwrite it? |
Making the new properties writable is a spec violation. I actually tested this with mongoose since they do weird things with streams and unfortunately missed this/didn't run into it. I'll see if I can open a PR to fix this in mongoose too. |
Wow mongoose's map is mutative that's so weird... hmm. Let me think about this a bit. |
Opened a Mongoose PR Automattic/mongoose#11381 |
First of all to the users who ran into this @Slayer95 @Uzlopak I am sorry! It was obviously not my intention to cause this breakage, I actually tested with Mongoose but probably not after the
This is required for spec compliance and to pass a language-proposal test. Though note you can still override non-writable properties as shown in the PR above. |
This is probably also fine, or make them writable in v17 but not v18 |
To solve this error need to install nvm (Node Version Manager) and run |
First of all, thank you for your quick reaction. For me personally nothing changes, as I am not using bleeding edge. But I guess those who want to use bleeding edge are effected ;). But this is tbh the risk someone takes if he/she uses bleeding edge. @benjamingr @Lysak |
For what it's worth Node.js takes the ecosystem very seriously and a breakage or performance regression in Mongoose because of a change in Node.js is definitely something we want to be aware of and to address. This is double true for breakage that causes programs to not work and even more so when the change isn't communicated in advance and labeled as semver-major. |
A fix landed in master and will be released with the next Node.js release - sorry for the mess! |
So shall we wait for the next release or find a temp. Solution? I need to fix it ASAP, please. |
@overmars86 you can either run a version you build from master (of either mongoose or node) or use a different (lts) version of Node in the meantime |
Hello, is there any ETA for the new release? |
PR-URL: nodejs#41931 Fixes: nodejs#41926 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com>
PR-URL: nodejs#41931 Fixes: nodejs#41926 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com>
Latest version 17.6.0 with the fix (#41931) is out : https://github.com/nodejs/node/releases/tag/v17.6.0 Not available in docker yet as :latest image still points to 1.17.5 but it should be available very soon. |
We're still seeing the same issue with Node 17.6.0: https://app.circleci.com/pipelines/github/DataDog/dd-trace-js/6164/workflows/aefc24ba-e863-47dc-9fc5-e0d1aca6c980/jobs/703409/steps |
Looks like we need to apply the same fix for all the new methods. |
Ok, there is already a merged pr that did this (the one porting more test262 tests)so I suggest we keep this open until the next release |
Version
17.5
Platform
Linux aras-Lenovo-Legion-5-17ARH05H 5.13.0-21-generic #21-Ubuntu SMP Tue Oct 19 08:59:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
We maintain the mongoose-project. Devs reported that node 17.5 is throwing a TypeError when using the package.
I tested it with node 17.5 and run the unit tests, and could reproduce the Error. When I test with node 17.4, there is no TypeError.
I checked the Changelog and there is no remark regarding a breaking change, nor does the changes implicate a breaking change in nodes behaviour.
So I assume that there is a Regression in node 17.5.
Maybe something with the attribute "map" is special?
Also is reported that adding "engines": { "node": ">=12.0.0 <17.5.0" }, to package.json fixes the issue.
Is there some nodejs quirk mode? Do we have to change something in our codebase to not raise this Error?
Just checkout mongoose-project, install dependencies, and run the tests under node 17.5
See also:
Automattic/mongoose#11377
How often does it reproduce? Is there a required condition?
Happens always.
What is the expected behavior?
Should not throw a TypeError like it did not throw in node <= 17.4 and unit tests should pass as usual.
What do you see instead?
When running the tests we get:
Additional information
No response
The text was updated successfully, but these errors were encountered: