cli: synth fails if cdk.out does not exist
See original GitHub issue🐛 Bug Report
What is the problem?
cdk synth
returns ENOENT: no such file or directory, open 'cdk.out/manifest.json'
when the cdk.out directory is not present.
However, this results in the creation of a default manifest.json, and subsequent calls to synth succeed
Reproduction Steps
from cdk project directory:
- mvn clean
- rm -rf cdk.out
- mvn compile
- cdk synth
Verbose Log
xxxxxxxxx:cdk xxxxxxxx$ ls
cdk.json cdk.out pom.xml src target
xxxxxxxxx:cdk xxxxxxxx$ mvn clean
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.xxx.xxx:project >--------------------
[INFO] Building project 0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ project ---
[INFO] Deleting /Users/xxxxxxxx/workspace/xxxxxxxx/cdk/target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.303 s
[INFO] Finished at: 2019-08-19T16:27:07-07:00
[INFO] ------------------------------------------------------------------------
xxxxxxxxx:cdk xxxxxxxx$ rm -rf cdk.out
xxxxxxxxx:cdk xxxxxxxx$ mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.xxx.xxx:project >--------------------
[INFO] Building project 0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ project ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/xxxxxxxx/workspace/xxxxxxxx/cdk/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ project ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/xxxxxxxx/workspace/xxxxxxxx/cdk/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.835 s
[INFO] Finished at: 2019-08-19T16:27:24-07:00
[INFO] ------------------------------------------------------------------------
xxxxxxxxx:cdk xxxxxxxx$ cdk synth
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.xxx.xxx:project >--------------------
[INFO] Building project 0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:java (default-cli) @ project ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.574 s
[INFO] Finished at: 2019-08-19T16:27:31-07:00
[INFO] ------------------------------------------------------------------------
ENOENT: no such file or directory, open 'cdk.out/manifest.json'
Environment
- CDK CLI Version: 1.4.0 (build 175471f)
- Module Version:
- OS: OSX Mojave
- Language: Java
Other information
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:16 (5 by maintainers)
Top Results From Across the Web
Troubleshooting common AWS CDK issues
npx aws-cdk runs the local version of the AWS CDK Toolkit if one exists. It falls back to the global version when a...
Read more >awslabs/aws-cdk - Gitter
Hi all, does anyone have any recommendations for making the CDK constructs provided by AWS-CDK compliant to a specific company? Should I use...
Read more >aws-cdk yarn synth -o /tmp/artifacts returning error ENOENT
A couple of errors existed: Firstable cdk.json app entry needed to point to index.ts "app": "npx ts-node --prefer-ts-exts src/cdk/index.ts".
Read more >AWS CDK Pipelines: Real-World Tips and Tricks (Part 2)
They are not chronological, nor do they explain the basics of CDK Pipelines. ... There are two main types, one is the CDK...
Read more >AWS CDK Toolkit - npm
If there are multiple stacks in your application, cdk synth will synthesize the cloud assembly to cdk.out . $ # Synthesize cloud assembly...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks to @ivoanjo who also had this problem, I’m able to reproduce this in Java.
I was able to reproduce this using our standard sample-app package from
cdk init -l=java
and modify the code to dropapp.synth()
. Runningcdk synth
on this when there’s nocdk.out/
folder gets this error.There seems to be some race condition between the
cdk.out/
folder being generated and when the CLI expects it to be present for parsing. This specifically happens when the app does not callapp.synth()
.For those encountering this issue, the workaround is for your app to call
app.synth()
at the end of the program.For me the issue was that I had missed the difference between the file in
bin
and the file inlib
, so I was missing:As soon as I added that back in I stopped getting the error about the missing file. It’d be great if we could improve the error message in this case.