Closed toha-nordic closed 6 months ago
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.
Describe the bug
When using
--template
withcdk diff
it crashes with CDK >=2.133.0 (tested up to 2.137.0):Expected Behavior
With CDK
2.132.0
it still works as before:Current Behavior
Notice if
--template
flag is removed, it works fine:Reproduction Steps
backend-cd
into CFN with CDKtmp/
cdk.out
:cdk synth -a 'dist/aws/cloudformation-cd.js'
--no-change-set
doesnt help):Cannot convert undefined or null to object [17:00:31] TypeError: Cannot convert undefined or null to object at Function.keys ()
at calculateTemplateDiff (/home/toha/.nvm/versions/node/v18.19.1/lib/node_modules/aws-cdk/lib/index.js:394:52274)
at diffTemplate (/home/toha/.nvm/versions/node/v18.19.1/lib/node_modules/aws-cdk/lib/index.js:394:50944)
at Object.fullDiff (/home/toha/.nvm/versions/node/v18.19.1/lib/node_modules/aws-cdk/lib/index.js:394:50728)
at printStackDiff (/home/toha/.nvm/versions/node/v18.19.1/lib/node_modules/aws-cdk/lib/index.js:433:166276)
at CdkToolkit.diff (/home/toha/.nvm/versions/node/v18.19.1/lib/node_modules/aws-cdk/lib/index.js:433:193682)
at async exec4 (/home/toha/.nvm/versions/node/v18.19.1/lib/node_modules/aws-cdk/lib/index.js:488:54378)
cdk diff --exclusively --color -vvv --template tmp/backend-cd.template.json -a cdk.out --no-change-set backend-cd [16:51:09] CDK toolkit version: 2.132.0 (build 9a51c89) [16:51:09] Command line arguments: { _: [ 'diff' ], exclusively: true, e: true, color: true, v: 3, verbose: 3, template: 'tmp/backend-cd.template.json', a: 'cdk.out', app: 'cdk.out', 'change-set': false, changeSet: false, lookups: true, 'ignore-errors': false, ignoreErrors: false, json: false, j: false, debug: false, ec2creds: undefined, i: undefined, 'version-reporting': undefined, versionReporting: undefined, 'path-metadata': undefined, pathMetadata: undefined, 'asset-metadata': undefined, assetMetadata: undefined, 'role-arn': undefined, r: undefined, roleArn: undefined, staging: true, 'no-color': false, noColor: false, ci: false, 'context-lines': 3, contextLines: 3, strict: false, 'security-only': false, securityOnly: false, processed: false, quiet: false, q: false, '$0': 'cdk', STACKS: [ 'backend-cd' ], 'S-t-a-c-k-s': [ 'backend-cd' ] } [16:51:09] cdk.json: { "app": "node --unhandled-rejections=strict dist/aws/deployment-app.js", "build": "yarn compile", "progress": "events" } [16:51:09] cdk.context.json: { "availability-zones:account=:region=us-east-1": [
"us-east-1a",
"us-east-1b",
"us-east-1c",
"us-east-1d",
"us-east-1e",
"us-east-1f"
],
"vpc-provider:account=:filter.vpc-id=vpc-00fe623bb1cb307af:region=us-east-1:returnAsymmetricSubnets=true": {
"vpcId": "vpc-00fe623bb1cb307af",
"vpcCidrBlock": "10.0.0.0/16",
"availabilityZones": [],
"subnetGroups": [
{
"name": "Public",
"type": "Public",
"subnets": [
{
"subnetId": "subnet-0dcd6214a092e97bb",
"cidr": "10.0.0.0/19",
"availabilityZone": "us-east-1a",
"routeTableId": "rtb-049bcd6081554adba"
},
{
"subnetId": "subnet-0439f6c9f8173550d",
"cidr": "10.0.32.0/19",
"availabilityZone": "us-east-1b",
"routeTableId": "rtb-001a243184f9a0bf6"
},
{
"subnetId": "subnet-0c08d9ed938abd694",
"cidr": "10.0.64.0/19",
"availabilityZone": "us-east-1c",
"routeTableId": "rtb-0ecad04cad49bd826"
}
]
},
{
"name": "Private",
"type": "Private",
"subnets": [
{
"subnetId": "subnet-0085d228d3e18249e",
"cidr": "10.0.96.0/19",
"availabilityZone": "us-east-1a",
"routeTableId": "rtb-0e68dc83a7eaee52b"
},
{
"subnetId": "subnet-0c1f57177b5f27e76",
"cidr": "10.0.128.0/19",
"availabilityZone": "us-east-1b",
"routeTableId": "rtb-08af3c4138d1a26ca"
},
{
"subnetId": "subnet-07492c442575dbd2c",
"cidr": "10.0.160.0/19",
"availabilityZone": "us-east-1c",
"routeTableId": "rtb-0743875d0f322eab2"
}
]
}
]
},
"vpc-provider:account=:filter.vpc-id=vpc-05c9125968a03fe97:region=us-east-1:returnAsymmetricSubnets=true": {
"vpcId": "vpc-05c9125968a03fe97",
"vpcCidrBlock": "10.0.0.0/16",
"availabilityZones": [],
"subnetGroups": [
{
"name": "Public",
"type": "Public",
"subnets": [
{
"subnetId": "subnet-0ae7ba04619dfc7af",
"cidr": "10.0.0.0/19",
"availabilityZone": "us-east-1a",
"routeTableId": "rtb-04b0440e27503b7c2"
},
{
"subnetId": "subnet-070b8abc78ee45cc4",
"cidr": "10.0.32.0/19",
"availabilityZone": "us-east-1b",
"routeTableId": "rtb-03f934535932dccf3"
},
{
"subnetId": "subnet-0dabcba1c8fee9aee",
"cidr": "10.0.64.0/19",
"availabilityZone": "us-east-1c",
"routeTableId": "rtb-0f6f68b9a7bbd1df1"
}
]
},
{
"name": "Private",
"type": "Private",
"subnets": [
{
"subnetId": "subnet-0b12f11b33aa588f0",
"cidr": "10.0.96.0/19",
"availabilityZone": "us-east-1a",
"routeTableId": "rtb-0c8fd18577d1db091"
},
{
"subnetId": "subnet-0c26ce5ac93015603",
"cidr": "10.0.128.0/19",
"availabilityZone": "us-east-1b",
"routeTableId": "rtb-033f5989cd6fec4db"
},
{
"subnetId": "subnet-04f624dc04d0b23ba",
"cidr": "10.0.160.0/19",
"availabilityZone": "us-east-1c",
"routeTableId": "rtb-020d6b2c9c6ce540d"
}
]
}
]
},
"ami:account=:filters.image-type.0=machine:filters.name.0=amzn-ami-vpc-nat-:filters.state.0=available:owners.0=amazon:region=us-east-1": "ami-04027ecc3f40c1801"
}
[16:51:09] merged settings: {
versionReporting: true,
assetMetadata: true,
pathMetadata: true,
output: 'cdk.out',
app: 'cdk.out',
build: 'yarn compile',
progress: 'events',
context: {},
debug: false,
toolkitBucket: {},
staging: true,
bundlingStacks: [ 'backend-cd' ],
lookups: true
}
[16:51:09] [trace] SdkProvider#withAwsCliCompatibleDefaults()
[16:51:09] Determining if we're on an EC2 instance.
[16:51:09] Does not look like an EC2 instance.
[16:51:09] Toolkit stack: CDKToolkit
[16:51:09] Setting "CDK_DEFAULT_REGION" environment variable to us-east-1
[16:51:09] [trace] SdkProvider#defaultAccount()
[16:51:09] [trace] SdkProvider#defaultCredentials()
[16:51:09] Resolving default credentials
[16:51:09] [trace] SDK#currentAccount()
[16:51:09] [trace] SDK#forceCredentialRetrieval()
[16:51:09] Reading cached notices from /home/toha/.cdk/cache/notices.json
[16:51:09] Retrieved account ID from disk cache
[16:51:09] Setting "CDK_DEFAULT_ACCOUNT" environment variable to
[16:51:09] context: {
'availability-zones:account=:region=us-east-1': [
'us-east-1a',
'us-east-1b',
'us-east-1c',
'us-east-1d',
'us-east-1e',
'us-east-1f'
],
'vpc-provider:account=:filter.vpc-id=vpc-00fe623bb1cb307af:region=us-east-1:returnAsymmetricSubnets=true': {
vpcId: 'vpc-00fe623bb1cb307af',
vpcCidrBlock: '10.0.0.0/16',
availabilityZones: [],
subnetGroups: [ [Object], [Object] ]
},
'vpc-provider:account=:filter.vpc-id=vpc-05c9125968a03fe97:region=us-east-1:returnAsymmetricSubnets=true': {
vpcId: 'vpc-05c9125968a03fe97',
vpcCidrBlock: '10.0.0.0/16',
availabilityZones: [],
subnetGroups: [ [Object], [Object] ]
},
'ami:account=:filters.image-type.0=machine:filters.name.0=amzn-ami-vpc-nat- :filters.state.0=available:owners.0=amazon:region=us-east-1': 'ami-04027ecc3f40c1801',
'aws:cdk:enable-path-metadata': true,
'aws:cdk:enable-asset-metadata': true,
'aws:cdk:version-reporting': true,
'aws:cdk:bundling-stacks': [ 'backend-cd' ]
}
yarn run v1.22.22
$ tsc -b
Done in 0.51s.
[16:51:10] --app points to a cloud assembly, so we bypass synth
[16:51:10] [trace] SdkProvider#resolveEnvironment()
[16:51:10] [trace] SdkProvider#defaultAccount()
[16:51:10] [trace] SdkProvider#baseCredentialsPartition()
[16:51:10] [trace] SdkProvider#resolveEnvironment()
[16:51:10] [trace] SdkProvider#obtainBaseCredentials()
[16:51:10] [trace] SdkProvider#defaultAccount()
[16:51:10] [trace] SdkProvider#defaultCredentials()
[16:51:10] [trace] SDK#currentAccount()
[16:51:10] [trace] SDK#forceCredentialRetrieval()
[16:51:10] Retrieved account ID from disk cache
[16:51:10] [trace] SdkProvider#forEnvironment()
[16:51:10] [trace] SdkProvider#resolveEnvironment()
[16:51:10] [trace] SdkProvider#obtainBaseCredentials()
[16:51:10] [trace] SdkProvider#defaultAccount()
[16:51:10] [trace] SdkProvider#defaultCredentials()
[16:51:10] [trace] SdkProvider#withAssumedRole()
[16:51:10] Assuming role 'arn:aws:iam:::role/cdk-hnb659fds-deploy-role--us-east-1'.
[16:51:10] [trace] SDK#forceCredentialRetrieval()
[16:51:11] [trace] SDK#cloudFormation()
[16:51:11] [trace] SDK#wrapServiceErrorHandling()
[16:51:11] [AWS cloudformation 200 0.722s 0 retries] describeStacks({ StackName: 'backend-cd' })
Resources
[~] AWS::Logs::LogGroup CodeBuildResultsLogGroup CodeBuildResultsLogGroup535329BA replace
└─ [~] LogGroupName (requires replacement)
├─ [-] /aws/codebuild/202403261110
└─ [+] /aws/codebuild/202404181350
✨ Number of stacks with differences: 1 [16:51:12] Reading cached notices from /home/toha/.cdk/cache/notices.json
NOTICES (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)
29420 (cli): List stack output change issue.
29483 (cli): Upgrading to v2.132.0 or v2.132.1 breaks cdk diff functionality