Toolkit: Assets are not re-built when a subsequent `synth`/`deploy` is called within the same node:process
- Dominant language
- TypeScript
- Stars
- 105
- Forks
- 122
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 71
Description
### Describe the bug
Now with `toolkit:deploy` and `toolkit:watch`, customers can write programs/libraries to invoke `deploy`/`synth` multiple times within the same process. This however causes some of the assets to not be rebuilt causing the change to be missed from the deployments.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
Assets should be correctly rebuilt for every changed asset for every deployment/synth
### Current Behavior
some of the assets are not rebuilt
### Reproduction Steps
Use this app https://github.com/Amplifiyer/cdk-synth-repro-app and run `npx tsx main.ts` and observe that the second deployment at https://github.com/Amplifiyer/cdk-synth-repro-app/blob/deefb326c63b918b76f5ced37ded038d4a4e8a5e/main.ts#L44-L47 does not pick up the change introduced.
### Possible Solution
Workaround is to have customers call `AssetStaging.clearAssetHashCache();` before each invocation.
A correct fix would be for this to be handled seamlessly at the CDK end. This may require AssetCache to be changed from singleton to an instance.
### Additional Information/Context
_No response_
### CDK CLI Version
0.1.5
### Framework Version
_No response_
### Node.js Version
20
### OS
MacOS
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.