-
Notifications
You must be signed in to change notification settings - Fork 9
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
AO-18716 fix node 14 non-existent property warning #139
Conversation
@cheempz I tested this change out and it does seem to resolve the issue I was seeing. There may be a few more of these to update though . . . I noticed that if I omitted the
|
Thanks for catching that @bdehamer! Could I prevail on you to give this one more try? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two changes appear to have fixed the warnings I was seeing 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for figuring this out
lgtm
I added a suggestion, but it is not crucial
cls = ao.cls; | ||
// check for property to avoid triggering node 14 warning on | ||
// non-existent property in unfinished module.exports | ||
if (ao.hasOwnProperty('cls')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a suggestion:
if ('cls' in ao) {
seems to be the pattern used in this code base for testing properties
hasOwnProperty
is a bit more restrictive, as it would return false for inherited properties
Less restrictive may be more future-proof
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any insight into which approach is preferable, but can confirm that the 'cls' in ao
style also prevents the warning from appearing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know :). I did consider the property in object
style checking but decided against it since these two properties are very specific to the agent and I didn't see a scenario where the agent would try inheriting them from some parent object.
if (ao.lambda) { | ||
// use property check that does not trigger node 14 warning on | ||
// non-existent property in unfinished module.exports | ||
if (ao.hasOwnProperty('lambda')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- dito -
@bdehamer ran into the following error with our agent version 10.0.0 on Node 14.15
Seems due to nodejs/node#29935 introduced in Node 14, and some examples of how other packages fixed it can be found in nodejs/node#32987