-
Notifications
You must be signed in to change notification settings - Fork 4.5k
β NOTICE (diff): cannot read properties of undefined on diff.Β #30241
Description
Please add your +1 π to let us know you have encountered this
Status
Resolved
What is the issue?
The latest version of aws-cdk (v2.142.0) has broken our chalice with cdk deployment with the below error:
Cannot read properties of undefined (reading 'includes')
Overview
The change.resourceType is typed as being a string, but with this change there are cases when change.resourceType can be undefined.
Workaround
The workaround would be to use versions<v2.142.0
Resolution
The issue has been reverted and has been patched as of v2.142.1
Related issues
No response
Expected Behavior
Usual behaviour shows the cloudformation changeset, which is still the case when using v2.141.0
Creating deployment package.
Reusing existing deployment package.
Stack tools-api
Hold on while we create a read-only change set to get a diff with accurate replacement information (use --no-change-set to use a less accurate but faster template-only diff)
Resources
[~] AWS::Serverless::Function ChaliceApp/ChaliceApp/OrchestrateModelRun OrchestrateModelRun replace
ββ [~] CodeUri (requires replacement)
ββ [~] .Key:
ββ [-] 468d08dade7d3b[52](https://github.com/org/tools-api/actions/runs/9115347347/job/25061454406#step:17:53)b777cb47a1433cf7e5721ca05b7122dc1bfee03cd135e1a7.zip
ββ [+] 2464c7bed007b4b9ea2423157ce2a46977e17099e954eb83776fcd5ca5f4a33a.zip
...
β¨ Number of stacks with differences: 1
Current Behavior
cd infrastructure
cdk diff -c stage=$TARGET_ENV --require-approval=never
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.9.19/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.19/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.19/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.19/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.19/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.19/x64/lib
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
AWS_SESSION_TOKEN: ***
AWS_DEFAULT_REGION: ***
TARGET_ENV: test01
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/pandera/engines/pandas_engine.py:66: UserWarning: Using typeguard < 3. Generic types like List[TYPE], Dict[TYPE, TYPE] will only validate the first element in the collection.
warnings.warn(
Creating deployment package.
Reusing existing deployment package.
Stack tools-api
Hold on while we create a read-only change set to get a diff with accurate replacement information (use --no-change-set to use a less accurate but faster template-only diff)
**Cannot read properties of undefined (reading 'includes')**
Error: Process completed with exit code 1.
Result with diff --verbose:
[15:27:57] Initiated creation of changeset: arn:aws:cloudformation:eu-west-2:xxxx:changeSet/cdk-diff-change-set/cc390834-330b-4166-b695-312e208dab30; waiting for it to finish creating...
[15:27:57] Waiting for changeset cdk-diff-change-set on stack tools-api to finish creating...
[15:27:58] Changeset cdk-diff-change-set on stack tools-api is still creating
[15:28:03] Changeset cdk-diff-change-set on stack tools-api is still creating
[15:28:08] Changeset cdk-diff-change-set on stack tools-api is still creating
[15:28:13] Removing existing change set with name cdk-diff-change-set if it exists
[15:28:13] Reading cached notices from C:\Users\ReeceMetcalfe\.cdk\cache\notices.json
Cannot read properties of undefined (reading 'includes')
[15:28:14] TypeError: Cannot read properties of undefined (reading 'includes')
at C:\Users\ReeceMetcalfe\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:404:30181
at C:\Users\ReeceMetcalfe\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:404:19344
at Array.forEach (<anonymous>)
at _DifferenceCollection.forEachDifference (C:\Users\ReeceMetcalfe\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:404:19333)
at _enhanceChangeImpacts (C:\Users\ReeceMetcalfe\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:404:30119)
at refineDiffWithChangeSet (C:\Users\ReeceMetcalfe\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:404:28333)
at fullDiff (C:\Users\ReeceMetcalfe\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:404:25024)
at printStackDiff (C:\Users\ReeceMetcalfe\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:443:166664)
at CdkToolkit.diff (C:\Users\ReeceMetcalfe\AppData\Roaming\npm\node_modules\aws-cdk\lib\index.js:443:195640)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Reproduction Steps
I'm unable to reproduce the issue with a small sample application. I will continue to try reproduce but wanted to raise here in case it might be obvious what the issue is.
CDK CLI Version
2.142.0
Framework Version
No response
Node.js Version
21.2.0
OS
Windows / Linux
Language
Python
Language Version
Python 3.9.13
Other information
No response