-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: synth fails if cdk.out does not exist #3717
Comments
Unable to reproduce. I ran the following commands on my Mac (OSX Mojave) running cdk version 1.4.0 $ cdk init app --language=java
...
$mvn compile
...
$ mvn clean && rm -rf cdk.out
$ mvn compile
...
$ cdk synth
Successfully synthesized to /Users/nija/workplace/cdk/hello-cdk-java/cdk.out
Supply a stack name (hello-cdk-1, hello-cdk-2) to display its template. I can also confirm that |
I was getting this error as well. Went away when I updated my cdk.ts file to the base example file. So some error in the cdk.ts code may be causing this. |
I also took a run at reproducing this issue and wasn't able to get to the error on Mac OS X (Mojave 10.14.6) Are you still running into this issue? |
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 There seems to be some race condition between the For those encountering this issue, the workaround is for your app to call |
I am having the same problem. However, the cause of the problem seems to differ in that in my case, it occurs whenever I specify an outdir other than cdk.out, whether or not I call app.synth(). I created a separate issue for this (#5815), since I think the cause is different. But the relevant details from that issue are copied below. If I synthesize without a modified outdir (producing a cdk.out/mainfest.json), and then synthesize with a modified outdir, it successfully outputs the expected files to the modified outdir. So it seems that at some point during the process it needs to read from cdk.out/manifest.json, whether or not the outdir property is set to cdk.out, and then it proceeds to behave as expected. It also appears that a cdk.out folder is created when running cdk synth with a modified outdir. Additionally, it seems that in at least one project where I am having this issue, running 'cdk deploy' deploys the templates in cdk.out, not the specified outdir. So it seems like currently the outdir is just not really useful. Is it possible that 'cdk.out' is hard-coded somewhere? |
I'm having this issue in a Lerna monorepo with Typescript:
If I create the file myself then it complains that it can't parse the version out of it, etc. I'm not sure why, and when I run the default |
For me the issue was that I had missed the difference between the file in const app = new cdk.App();
new MyStack(app, 'MyStack'); 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. |
This may help some people on MacOS. I was having a hard time occasionally with this and it turned out that my script set TMPDIR at some point and then deleted that directory. Later on nodejs picked that up and tries to extract stuff to TMPDIR and we end up with |
this is such a great idea but rather disappointing implementation: Java project blocked: then blocked completely by:
when use
|
Also there is bug generating excessive file name after adding one line of code: // The code that defines your stack goes here
/*
new Function( this, "lambda", FunctionProps.builder()
.functionName( "tmp-tst135" )
.runtime( Runtime.NODEJS_12_X )
.code( Code.fromAsset( "", ))
.environment( Map.of( "aaa", "kkk" ))
.handler( "abc-handler" )
.build() );*/
|
I was getting the same error.
Code:
However, after adding
I then got the expected output when running
So check that you have Hope this is helpful in some way. |
@shivlaks @SomayaB it looks like ya'll closed #5815 to track the issue here, but it doesn't look like it's actually being tracked. this has been a persistent issue for a year and a half now. would be really cool if one of the maintainers there at AWS could give this a look. |
This is the offending line
I've added logging there and can confirm that it's called twice; once with the correct custom
I'll continue to trace this and will follow up. Update So you can see here that the correct call has a completely different stack trace than the incorrect call, meaning that we've got one entity behaving properly and instantiating the Correct:
Incorrect:
|
Here's the offending block in the aws-cdk/packages/aws-cdk/lib/api/cxapp/exec.ts Lines 68 to 92 in 5a6fa7f
The code looks for @rix0rrr @shivlaks @SomayaB There's the triage. Can we get a fix or some documentation around this? |
I don't think setting Now that you mention it, I'm not sure why we have that property in the first place. I guess it is for unit tests. @eladb you added this property in #2636... do you happen to remember why it is configurable from inside the CDK app? |
If this property is passed it has to agree with the CLI's `--output` flag. If this property is not passed, it will default to the CLI's `--output` flag. In either case, it's better to just use `--output` and not pass this property at all; the property only has value inside tests. Fixes #3717.
If this property is passed it has to agree with the CLI's `--output` flag. If this property is not passed, it will default to the CLI's `--output` flag. In either case, it's better to just use `--output` and not pass this property at all; the property only has value inside tests. I tried to add validation (by using `Annotations.of(app).addWarning()` but they are useless anyway: in the CX protocol, metadata can only be attached to `StackArtifacts`, so metadata attached to the `App` will not be rendered. Adding a full framework feature to move metadata to a different place feels like too much risk and work for this small note, so turned it into a documentation fix. Fixes #3717. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
If this property is passed it has to agree with the CLI's `--output` flag. If this property is not passed, it will default to the CLI's `--output` flag. In either case, it's better to just use `--output` and not pass this property at all; the property only has value inside tests. I tried to add validation (by using `Annotations.of(app).addWarning()` but they are useless anyway: in the CX protocol, metadata can only be attached to `StackArtifacts`, so metadata attached to the `App` will not be rendered. Adding a full framework feature to move metadata to a different place feels like too much risk and work for this small note, so turned it into a documentation fix. Fixes aws#3717. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
🐛 Bug Report
What is the problem?
cdk synth
returnsENOENT: 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:
Verbose Log
Environment
Other information
The text was updated successfully, but these errors were encountered: