-
Notifications
You must be signed in to change notification settings - Fork 4.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
fix(core): DefaultSynthesizer breaks this.node.setContext() on Stack #10246
Conversation
Since the `DefaultSynthesizer` recently started adding constructs into the Stack at construction time, that broke `this.node.setContext()` which requires that no children have been added to a construct yet when its context is being modified. To fix this, add the constructs just-in-time just before the stack is being synthesized. In order to give the `DefaultStackSynthesizer` a chance to modify the stack's construct tree before its template is being written out, the Synthesizer is now in full control of the order in which things happen. Change the call tree from: ``` synthesizeTree - stack._synthesizeTemplate - (write template) - this.synthesizer.synthesizeStackArtifacts - (register artifacts) ``` To: ``` synthesizeTree - stack.synthesizer.synthesize - stack._synthesizeTemplate - (write template) - (register artifacts) ``` All APIs involved in this call tree are either `@experimental` or `@internal`. BREAKING CHANGE: custom implementations of `IStackSynthesizer` must now implement `synthesize()` instead of `synthesizeStackArtifacts()`.
assertBound(this.stack); | ||
|
||
this.stack._synthesizeTemplate(session); |
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.
Do we really need to relay back to Stack? Maybe we can just move all the code into here?
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.
_synthesizeTemplate
is accessing all private members. This feels cleaner than exposing those.
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.
👍
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Since the
DefaultSynthesizer
recently started adding constructs intothe Stack at construction time, that broke
this.node.setContext()
which requires that no children have been added to a construct yet
when its context is being modified.
To fix this, add the constructs just-in-time just before the stack
is being synthesized.
In order to give the
DefaultStackSynthesizer
a chance to modifythe stack's construct tree before its template is being written out,
the Synthesizer is now in full control of the order in which things
happen.
Change the call tree from:
To:
All APIs involved in this call tree are either
@experimental
or@internal
.BREAKING CHANGE: custom implementations of
IStackSynthesizer
must now implement
synthesize()
instead ofsynthesizeStackArtifacts()
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license