You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(watch) cdk watch hangs indefinitely (no error) on a stack with a CfnParameter that has no default #1648
cdk watch hangs indefinitely — with no error, progress, or fallback — when a watched stack declares a CfnParameter that has no default. The hotswap template evaluator can't resolve the parameter, and instead of erroring or falling back, watch silently sits at deploying... forever.
A stack that declares a parameter without a default, plus a hotswappable resource:
newcdk.CfnParameter(this,'Foo',{type: 'String'});// no defaultnewlambda.Function(this,'Fn',{/* inline code */});
cdk watch (after the stack already exists, so watch attempts a hotswap) prints MyStack: deploying... and then hangs forever — no progress, no error, no hotswap, no fallback. CPU idle, no network.
cdk deploy --hotswap MyStack of the same stack does not hang.
Adding default: '' to the parameter, or removing the parameter, fixes the hang.
Passing --parameters does not help (hotswap's read-only template evaluation appears to resolve from template defaults, not CLI --parameters).
Analysis
This looks like the hotswap template evaluator failing to resolve a parameter with no default (cf. aws/aws-cdk#22323), but in watch it manifests as a silent infinite hang rather than an error or fallback.
Expected
Error out (or fall back to a full CloudFormation deployment), not hang silently.
Workaround
Give every CfnParameter a default so the hotswap evaluator can resolve it; the real value is still supplied at deploy via --parameters (which overrides the default), and cdk deploy falls back correctly when there's a non-hotswappable change:
Better still (AWS recommends against CfnParameter with CDK): avoid the parameter entirely — resolve the value at synth (context/env) or, for secrets, via a CloudFormation dynamic reference such as cdk.SecretValue.secretsManager(...) / {{resolve:secretsmanager:...}}, which keeps the value out of the template and leaves no CfnParameter for the evaluator to choke on. (Note: Cognito UserPoolIdentityProvider.ProviderDetails accepts secretsmanager dynamic references but notssm-secure ones.)
Related
aws/aws-cdk#22323 — hotswap deploy fails on CfnEvaluationException (same template-evaluator root cause; here it surfaces as a silent hang in watch rather than an error).
changed the title [-]`cdk watch` hangs indefinitely (no error) on a stack with a `CfnParameter` that has no default[/-][+](watch) `cdk watch` hangs indefinitely (no error) on a stack with a `CfnParameter` that has no default[/+]on Jun 19, 2026
Activity
[-]`cdk watch` hangs indefinitely (no error) on a stack with a `CfnParameter` that has no default[/-][+](watch) `cdk watch` hangs indefinitely (no error) on a stack with a `CfnParameter` that has no default[/+]