-
Notifications
You must be signed in to change notification settings - Fork 4k
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): Aspects from symlinked modules are not applied #19491
Conversation
When construct libraries are purposely symlinked (as opposed of collectively `npm install`ed), depending on how this is done they may end up with multiple copies of `aws-cdk-lib`. If that happens, Aspects from a different `aws-cdk-lib` copy than the one providing `App` will not be applied. The reason is the use of `Symbol('...')` instead of `Symbol.for('...')` to keep the list of aspects on the construct object. - The first version creates a unique symbol per library, while adding a naming hint. - The second version deduplicates: all symbols with the same naming hint will receive the same symbol. The second version is necessary to make sure that different copies of the `aws-cdk-lib` library store their aspects under the same key. Fixes #18921, #18778, #19390.
No test as the fault only manifests in situations we cannot test 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.
Mind. blown. Nice work, @rix0rrr.
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). |
When construct libraries are purposely symlinked (as opposed of
collectively
npm install
ed), depending on how this is done they mayend up with multiple copies of
aws-cdk-lib
. If that happens, Aspectsfrom a different
aws-cdk-lib
copy than the one providingApp
willnot be applied.
The reason is the use of
Symbol('...')
instead ofSymbol.for('...')
to keep the list of aspects on the construct object.
a naming hint.
hint will receive the same symbol.
The second version is necessary to make sure that different copies
of the
aws-cdk-lib
library store their aspects under the same key.Fixes #18921, #18778, #19390, #18914