-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[sdk/nodejs] Fix a bug in closure serialization. #6999
Conversation
PR is now waiting for a maintainer to run the acceptance tests. Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR |
PR is now waiting for a maintainer to run the acceptance tests. Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR |
Bravo! |
/run-acceptance-tests |
Please view the results of the PR Build + Acceptance Tests Run Here |
2 similar comments
Please view the results of the PR Build + Acceptance Tests Run Here |
Please view the results of the PR Build + Acceptance Tests Run Here |
@lukehoban Any plans on merging this? I'm stumbling across many issues with this, unfortunately |
PR is now waiting for a maintainer to run the acceptance tests. Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR |
@@ -1309,7 +1309,7 @@ return function () { console.log(v); }; | |||
|
|||
var __v = {}; | |||
var __v_d1_proto = {}; | |||
__f1.prototype = __v_d1_proto; | |||
Object.defineProperty(__f1, "prototype", { value: __v_d1_proto }); |
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.
The one thing I'm slightly nervous about is that this change will cause a lot of usage of closure serialization to change - which will lead to e.g. redeploying all Lambdas when this version of Pulumi is adopted. That's not necessarily a blocker - though it is a downside we'll need to message.
I was initially wondering if this particular part of the change could be suppressed - but I do see that it is also technically incorrect to do what we were doing previously.
How would you characterize the cases where serialization would change after this PR? Is it "if you serialize a class definition, the serialization will be different"?
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.
How would you characterize the cases where serialization would change after this PR? Is it "if you serialize a class definition, the serialization will be different"?
That characterization sounds good to me.
This PR could also affect any function whose property is defined via Object.defineProperty
, but I don't think there are many use cases other than class definition.
@lukehoban @swen128 is this ready to go? |
PR is now waiting for a maintainer to run the acceptance tests. Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR Further commands available:
|
Yes - I think we should merge this. It will lead to some magic functions being redeployed even with no user changes, but we've generally been okay with that in minor versions in the past. |
/run-acceptance-tests |
Please view the results of the PR Build + Acceptance Tests Run Here |
PR is now waiting for a maintainer to run the acceptance tests. Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR Further commands available:
|
Description
When a closure captures an object which has complex properties (e.g. getters / setters), Pulumi serializes the properties using the
defineProperty
function.This does not work properly if a function object has complex properties.
For example, when a class has a static getter, the getter is evaluated at deploy time and the returned value is used to serialize the class.
The above script prints out the following serialized code (Notice the random value injected):
Fixes #6908
The reported error occurs when Pulumi tries to serialize a getter BaseEntity.target
Checklist