-
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
(cdk pipelines): primary output directory root/cdk.out
generates errors since notices release
#19234
Comments
root/cdk.out
generates errors
Hey @gbvanrenswoude, Just to confirm the nature of this report. You are getting error alerts in the output but the stack builds successfully, correct? |
The stack indeeds builds correctly. We have done the |
Hi. I would like to share how I resolved the problem similar to this. I had a similar issue like this but in my case, it failed at "UpdatePipeline" stage.
I re-ran the CDK workshop (https://cdkworkshop.com/) from the start to end. For your information, this is my code change.
I am not completely sure which of this code change did the trick but my hunch tells me maybe it's related with changing from I hope it helps. |
And the whole pipeline didn't take long time. Mine had quite many resources and took the reasonable time it usually took: 10 minutes 29 seconds. |
@byongwu based on your remarks, I made some runs with |
@gbvanrenswoude Thanks for sharing. Then it must have been some other problem. Since the CDK workshop is an open source, let me share the typescript + CodePipeline working code (cdk-workshop-v2.16.0.tar.gz) based on the latest CDK (v2.16.0). I checked it with my AWS account and CodePipeline deployed fine. But, as a side note, I would like to a comment that since CDK is so rapidly upgrading, it is forcing the production & previously-stable users to upgrade to the latest CDK. I mean there shouldn't be deployment problem if the user didn't touch anything except their code. |
root/cdk.out
generates errorsroot/cdk.out
generates errors since notices release
I am actually having my Update stage failing with: Failed to get tree.json file: Error: cdk.out/tree.json: ENOTDIR: not a directory, open 'cdk.out/tree.json' My CDK is in the
I looked at the S3 artifact zip file being generated and it looks pretty much like I would expect it to: I do have cdk --version 2.16.0 (build 4c77925), but I will say, I did have an older version installed when I did the cdk init originally (2.10?) Also, when I originally ran |
Hi there - I've also noticed this error on some CodeBuild jobs, but I believe this error message "Failed to get tree.json file" is actually just intended to be an debug message as part of the CDK notices mechanism. When it gets printed, we actually catch the error so that it does not cause the CDK command to fail. This is based on what I found from digging into our source code here: aws-cdk/packages/aws-cdk/lib/notices.ts Lines 322 to 329 in 697fdbe
I think it's possible that in these scenarios, the cause of build failures may be something different in the build logs. Here's an example from our build, showing that the actual error is located nearby: I'm not totally sure why this is printed red in codebuild when other "debug" lines aren't printed red, but I've submitted a PR that should try and improve the wording (#19887). |
Related to #19234. This improves the log wording so it's more clear this is not a "hard stop" error, and switch the log level to "trace" so it won't be shown in as many ordinary logs as a false positive error. ---- ### All Submissions: * [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Related to aws#19234. This improves the log wording so it's more clear this is not a "hard stop" error, and switch the log level to "trace" so it won't be shown in as many ordinary logs as a false positive error. ---- ### All Submissions: * [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
It's been three months since this issue was opened, has anyone been able to solve this and get a pipeline to successfully pass through the UpdatePipeline - SelfMutate step? The error I receive is My pipeline exists in a monorepo setup like: packages/
client/
server/
...cdk stuff
shared/ where the cdk is in the server folder. The error seems to be searching for the cdk output after synth in the root of this monorepo instead of packages/server, despite setting the const pipeline = new cdk.pipelines.CodePipeline(this, "Pipeline", {
pipelineName: app_name + "pipeline",
// stop $1/month kms key charge
crossAccountKeys: false,
// the purpose of this step is to create a cdk.out folder via cdk synth command
synth: new cdk.pipelines.ShellStep("Synth", {
input: cdk.pipelines.CodePipelineSource.gitHub(
props!.repo_name,
props!.branch_name,
{ authentication: github_token }
),
commands: [
"yarn install",
// go into server folder first
"cd packages/server",
// then install and synth the cdk there
"yarn install",
"yarn build",
"npx cdk synth --all -c stage=" + env_name,
// then move the folder back up to the root so the build step can pass and hopefully the next step
"mv cdk.out ../..",
],
primaryOutputDirectory: "packages/server",
}),
})
// ...
pipeline.addStage(server_stage)
pipeline.addStage(client_stage) You can see the Any help or work arounds on this would be great. My understanding is that this is an issue in the current cdk versions, which don't seem to work well with monorepos. |
Also running into this issue. Has anyone made it work with a monorepo? |
It turns out
This was happening because I didn't have More about this issue: |
@55Cancri Reason for the issue: Hope that helps. |
@froilan so what is the workaround exactly? thnx |
I was running into a similar issue. I needed to specify the
|
Any solution guys? 😢 |
Yeah, switch to sst v3 and use GitHub actions |
What is the problem?
We observe in the default cdk pipeline:
Note, we have the
cdk root
of our project in /infrastructure folder. That is specified in code:It does not result in error, just in a very long wait and then succesful exit.
Reproduction Steps
What did you expect to happen?
Pipeline result:
What actually happened?
CDK CLI Version
2.13.0
Framework Version
No response
Node.js Version
17
OS
MacOs
Language
Typescript
Language Version
TS 4
Other information
No response
The text was updated successfully, but these errors were encountered: