-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
Cannot read private member #context from an object whose class did not declare it #50891
Comments
This issue goes all the way back to v20.0.0 |
Have determined this is the result of @hapi/hoek/lib/clone.js which copies an https-proxy-agent options object which contains a parsed URL. This code reproduces the effect:
The clone util then goes on to copy all the properties but that's not even necessary. Just the raw object throws the error
|
Closing as this is clearly an issue with @Hapi deep cloning and Node is behaving as designed. |
Version
v20.10.0
Platform
Oracle Enterprise Linux 7
Subsystem
lib/internal/url.js ?
What steps will reproduce the bug?
This occurs when @hapi/wreck is attempting to process a request. The error string above does NOT appear in the source of wreck or anything else in any node_modules directory.
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior? Why is that the expected behavior?
Should not fail.
What do you see instead?
err: TypeError: Client request error: Cannot read private member #context from an object whose class did not declare it
Additional information
I added a
console.log(new Error().stack)
into @hapi/wreck/lib/index.js to try work out where the error came from. Trace below:The string
context
does not appear in @hapi/wreck at all.The string
#context
does not appear anywhere in my source ornode_modules
.The error message does not appear in that form ANYWHERE I can find in files on my machine. There are several instances WITHOUT the identifier but it must be generated here:
deps/v8/src/common/message-template.h:493: "Cannot read private member % from an object whose class did not declare "
I am guessing this is caused by some inbuilt JavaScript in Node itself? In fact, I'm guessing
lib/internal/url.js
based on a grep of the source for#context
.This does NOT happen in v18.18.2 and earlier. I switched to v20.9 when it went LTS. Issue persists in v20.10. Have not tried any v20 before v20.9
The version of our source and of node_modules is unchanged between v18.18.2 and v20 (just running new node manually on same deployment tree fails).
The text was updated successfully, but these errors were encountered: