Skip to content

Annotation errors not stopping generation of CloudFormation #18317

@nevstokes

Description

@nevstokes

What is the problem?

As per the title, running cdk synth on code that uses Aspects to add an Error via Annotations is still generating CloudFormation. According to the relevant inline documentation, "The toolkit will fail synthesis when errors are reported."

Reproduction Steps

Example code: https://pastebin.com/VVvmZFhS

What did you expect to happen?

I expected:

  • an error message to be displayed on the cli
  • a non-zero exit code to be returned
  • no CloudFormation to be generated

What actually happened?

Running cdk synth on the code available at https://pastebin.com/VVvmZFhS results in:

  • an error message is displayed on the cli
  • an exit code of 1 is returned
  • CloudFormation output is still generated, despite the error

CDK CLI Version

2.4.0 (build 993f14d)

Framework Version

No response

Node.js Version

v16.13.0

OS

macOS Monterey 12.1

Language

Typescript

Language Version

Typescript 4.5.4

Other information

I've raised this in the cdk.dev Slack channel where the same behaviour has been reproduced by others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2package/toolsRelated to AWS CDK Tools or CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions