Summary
There is no supported way to write a CloudFormation outputs file during cdk watch. cdk deploy writes outputs via either --outputs-file or the cdk.json outputsFile key; cdk watch honors neither, so a frontend/consumer outputs file can't be kept in sync during a watch session.
Environment
aws-cdk (CLI): 2.1128.0 (build 7daa104)
aws-cdk-lib: 2.258.1
- node:
v24.12.0
- OS: macOS
26.5.1 (Darwin)
Reproduction
cdk watch --outputs-file out.json → Unknown option(s): --outputs-file, --outputsFile. These will be ignored.
- The
cdk.json "outputsFile" key is silently ignored by cdk watch (it is honored by cdk deploy, verified on 2.1128.0).
Expected
cdk watch honors outputsFile (and/or --outputs-file), since it is cdk deploy --watch and each watch deployment is a deploy — or the limitation is documented.
Workaround
Run a cdk deploy --hotswap --outputs-file ... once before cdk watch to produce the outputs file, then watch for iteration (watch deployments don't change stack outputs).
Related
- aws/aws-cdk-cli#1389 — the separate
cdk deploy --outputs-file "no file written" regression; appears resolved on 2.1128.0 (the flag does write for cdk deploy here), so this issue is specifically about watch having no outputs-file mechanism.
Summary
There is no supported way to write a CloudFormation outputs file during
cdk watch.cdk deploywrites outputs via either--outputs-fileor thecdk.jsonoutputsFilekey;cdk watchhonors neither, so a frontend/consumer outputs file can't be kept in sync during a watch session.Environment
aws-cdk(CLI):2.1128.0(build 7daa104)aws-cdk-lib:2.258.1v24.12.026.5.1(Darwin)Reproduction
cdk watch --outputs-file out.json→Unknown option(s): --outputs-file, --outputsFile. These will be ignored.cdk.json"outputsFile"key is silently ignored bycdk watch(it is honored bycdk deploy, verified on2.1128.0).Expected
cdk watchhonorsoutputsFile(and/or--outputs-file), since it iscdk deploy --watchand each watch deployment is a deploy — or the limitation is documented.Workaround
Run a
cdk deploy --hotswap --outputs-file ...once beforecdk watchto produce the outputs file, then watch for iteration (watch deployments don't change stack outputs).Related
cdk deploy --outputs-file"no file written" regression; appears resolved on 2.1128.0 (the flag does write forcdk deployhere), so this issue is specifically aboutwatchhaving no outputs-file mechanism.