aws / aws/aws-cdk-cli

(watch) `cdk watch` has no way to write a CloudFormation outputs file (`--outputs-file` and cdk.json `outputsFile` both ignored)

Open
#1,649 0 comments 0 reactions 0 assignees View on GitHub
aws-cdk p2
Dominant language
TypeScript
Stars
105
Forks
122
Avg merge
1d 17h
Merged PRs (30d)
71

Description

### 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](https://github.com/aws/aws-cdk-cli/issues/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.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the `cdk watch` option parsing and its watch deployment path, then compare how `cdk deploy` handles `--outputs-file` and the `outputsFile` configuration key. Done means watch deployments honor the supported outputs-file configuration or the limitation is documented, with coverage for the reproduced commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cli, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.