Skip to content

(cli): cdk watch does not recover if there is an error in cdk stack/app #27864

@ssingh-01

Description

@ssingh-01

Describe the bug

If I made an error that does not resolve into a valid cloudformation, cdk watch throws the error on console. However, if I fix that issue, I would expect cdk to detect the issue to resolve and deploy the correct cloudformation template. CDK watch gets hung instead.

Expected Behavior

Expect cdk watch to redeploy once the error has been fixed.

Current Behavior

If I made an error that does not resolve into a valid cloudformation, cdk watch throws the error on console. However, if I fix that issue, CDK watch gets hung. It detects the change but does not deploy.

Reproduction Steps

This is a valid stack and app :

app = App()
ApiEventBridgeLambdaStack(app, "ApiEventBridgeLambdaStack")

If I update it to the following while cdk watch is running, cdk watch will throw the error but stays hung after I fix the error (remove a mistyped N in this case):

app = App()
ApiEventBridgeLambdaStack(appN, "ApiEventBridgeLambdaStack")

This happens with stack level changes as well.

Detects change but does not deploy, stays in hung state :

image

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

v2.100.0

Framework Version

No response

Node.js Version

v18.16.0

OS

MAC

Language

Python

Language Version

3.10.6

Other information

Reproducible with typescript too
Workaround is to interrupt the terminal and re run cdk watch.

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.cliIssues related to the CDK CLIeffort/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