Skip to content

(cli): TypeError: localAspects is not iterable #32470

@github2023spring

Description

@github2023spring

Please add your +1 👍 to let us know you have encountered this

Status: IN-PROGRESS

Overview:

Users who run into this issue have multiple copies of aws-cdk-lib in your dependency tree at different versions. For example using a construct library that directly depends on a different aws-cdk-lib version, or from local symlinking multiple workspace directories together (npm link), or a messy npm install history.

In those cases, if you get an Aspects object from an older aws-cdk-lib version, then aspects.applied would return undefined which definitely is not iterable!

Complete Error Message:

^
TypeError: localAspects is not iterable
at sortAspectsByPriority (/local/p4clients/pkgbuild-gX619/workspace/src/MarsCompatibilityMessageCDK/node_modules/aws-cdk-lib/core/lib/private/synthesis.js:2:4349)
at recurse (/local/p4clients/pkgbuild-gX619/workspace/src/MarsCompatibilityMessageCDK/node_modules/aws-cdk-lib/core/lib/private/synthesis.js:2:3271)
at recurse (/local/p4clients/pkgbuild-gX619/workspace/src/MarsCompatibilityMessageCDK/node_modules/aws-cdk-lib/core/lib/private/synthesis.js:2:4167)
at recurse (/local/p4clients/pkgbuild-gX619/workspace/src/MarsCompatibilityMessageCDK/node_modules/aws-cdk-lib/core/lib/private/synthesis.js:2:4167)
at recurse (/local/p4clients/pkgbuild-gX619/workspace/src/MarsCompatibilityMessageCDK/nod

Workaround:

Downgrade to CDK v2.171.1, Rolling forward to CDK v2.173.3 when released, or fixing the dependency issue in your CDK app.

Solution:

#32647

Related Issues:


Original Issue:

Describe the bug

After updating to 2.172.0, the cdk synth command produce the following error message.

^
TypeError: localAspects is not iterable
at sortAspectsByPriority (/local/p4clients/pkgbuild-gX619/workspace/src/MarsCompatibilityMessageCDK/node_modules/aws-cdk-lib/core/lib/private/synthesis.js:2:4349)
at recurse (/local/p4clients/pkgbuild-gX619/workspace/src/MarsCompatibilityMessageCDK/node_modules/aws-cdk-lib/core/lib/private/synthesis.js:2:3271)
at recurse (/local/p4clients/pkgbuild-gX619/workspace/src/MarsCompatibilityMessageCDK/node_modules/aws-cdk-lib/core/lib/private/synthesis.js:2:4167)
at recurse (/local/p4clients/pkgbuild-gX619/workspace/src/MarsCompatibilityMessageCDK/node_modules/aws-cdk-lib/core/lib/private/synthesis.js:2:4167)
at recurse (/local/p4clients/pkgbuild-gX619/workspace/src/MarsCompatibilityMessageCDK/nod

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

2.171.1

Expected Behavior

cdk synth should produce cloudformation template

Current Behavior

cdk synth failed

Reproduction Steps

Updating to 2.172.0, and run cdk synth.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.172.0

Framework Version

No response

Node.js Version

v20.18.1

OS

MacOs

Language

TypeScript

Language Version

5.7.2

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.management/trackingIssues that track a subject or multiple issuesp0package/toolsRelated to AWS CDK Tools or CLIpotential-regressionMarking this issue as a potential regression to be checked by team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions