Skip to content

Commit

Permalink
fix(core): Stacks from 3rd-party libraries do not synthesize correctly
Browse files Browse the repository at this point in the history
Even though this is arguably somewhat of an antipattern and user error:

- You should not be vending `Stack`s from libraries.
- All libraries should be using a single version of the CDK so that
  NPM can dedupe it (or use `peerDependencies` to avoid this altogether)

This is still a sharp edge that we can blunt a little by not using
the `instanceof` language feature.

No test because it needs a second copy of the CDK to expose it.

Fixes #10671.
  • Loading branch information
rix0rrr committed Oct 5, 2020
1 parent 9e11e5a commit 5e10b94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/core/lib/private/synthesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function synthesizeTree(root: IConstruct, builder: cxapi.CloudAssemblyBuilder) {
assembly: builder,
};

if (construct instanceof Stack) {
if (Stack.isStack(construct)) {
construct.synthesizer.synthesize(session);
} else if (construct instanceof TreeMetadata) {
construct._synthesizeTree(session);
Expand Down

0 comments on commit 5e10b94

Please sign in to comment.