Steps to reproduce issue 367 after cloning the repository:
cd cdk
npm ci
npx cdk synth
$ npx cdk synth
Cannot read property 'metadata' of undefined
Subprocess exited with error 1
$ ts-node bin/cdk.ts
/Users/tmarcinkowski/work_personal/demo-aws-solutions-constructs-issue-367/cdk/node_modules/@aws-solutions-constructs/core/lib/utils.ts:144
if (resource.cfnOptions.metadata?.cfn_nag?.rules_to_suppress) {
^
TypeError: Cannot read property 'metadata' of undefined
at Object.addCfnSuppressRules (/Users/tmarcinkowski/work_personal/demo-aws-solutions-constructs-issue-367/cdk/node_modules/@aws-solutions-constructs/core/lib/utils.ts:144:27)
at updateSecurityPolicy (/Users/tmarcinkowski/work_personal/demo-aws-solutions-constructs-issue-367/cdk/node_modules/@aws-solutions-constructs/core/lib/cloudfront-distribution-helper.ts:31:3)
at Object.CloudFrontDistributionForS3 (/Users/tmarcinkowski/work_personal/demo-aws-solutions-constructs-issue-367/cdk/node_modules/@aws-solutions-constructs/core/lib/cloudfront-distribution-helper.ts:99:3)
at new CloudFrontToS3 (/Users/tmarcinkowski/work_personal/demo-aws-solutions-constructs-issue-367/cdk/node_modules/@aws-solutions-constructs/aws-cloudfront-s3/lib/index.ts:55:20)
at new Issue367Stack (/Users/tmarcinkowski/work_personal/demo-aws-solutions-constructs-issue-367/cdk/bin/cdk.ts:11:9)
at Object.<anonymous> (/Users/tmarcinkowski/work_personal/demo-aws-solutions-constructs-issue-367/cdk/bin/cdk.ts:16:1)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Module.m._compile (/Users/tmarcinkowski/.nvm/versions/node/v14.17.0/lib/node_modules/ts-node/src/index.ts:1225:23)
at Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Object.require.extensions.<computed> [as .ts] (/Users/tmarcinkowski/.nvm/versions/node/v14.17.0/lib/node_modules/ts-node/src/index.ts:1228:12)
$ npx cdk --version
1.120.0 (build 6c15150)
$ npm ls @aws-cdk/core aws-cdk @aws-cdk/assert @aws-solutions-constructs/aws-cloudfront-s3
[email protected] /Users/tmarcinkowski/work_personal/demo-aws-solutions-constructs-issue-367/cdk
├─┬ @aws-cdk/[email protected]
│ └── @aws-cdk/[email protected]
├── @aws-cdk/[email protected]
├─┬ @aws-solutions-constructs/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ ├── @aws-cdk/[email protected]
│ │ │ └─┬ @aws-cdk/[email protected]
│ │ │ ├─┬ @aws-cdk/[email protected]
│ │ │ │ └── @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ ├─┬ @aws-cdk/[email protected]
│ │ │ │ └── @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ ├─┬ @aws-cdk/[email protected]
│ │ │ │ └── @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├── @aws-cdk/[email protected]
│ └─┬ @aws-solutions-constructs/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ ├─┬ @aws-cdk/[email protected]
│ │ │ └── @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ ├─┬ @aws-cdk/[email protected]
│ │ └── @aws-cdk/[email protected]
│ └── @aws-cdk/[email protected]
└── [email protected]
$ npx --version
6.14.13
$ ts-node --version
v10.1.0