Skip to content
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-cli): Difficult to track cdk deploy issues #26924

Closed
gabriels1234 opened this issue Aug 29, 2023 · 8 comments
Closed

(cdk-cli): Difficult to track cdk deploy issues #26924

gabriels1234 opened this issue Aug 29, 2023 · 8 comments
Assignees
Labels
bug This issue is a bug. effort/medium Medium work item – several days of effort p1 package/tools Related to AWS CDK Tools or CLI response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@gabriels1234
Copy link

Describe the bug

Hi, this is between a bug and an annoyance.

When running cdk deploy , any error (in red) will make the deployment to fail.

The error is key to finding a solution.

But the real error disappears (sometimes too quickly) so we need to be trained into:

  • See red, pless control-C to halt execution, copy error and do the research to fix it.

This need not to be this way.

Expected Behavior

The summary need to include all the errors.

Current Behavior

Dev/MyStack (Dev-MyStack) failed: Error: The stack named Dev-MyStack failed to deploy: UPDATE_ROLLBACK_COMPLETE
    at FullCloudFormationDeployment.monitorDeployment (/Users/user/.nvm/versions/node/v18.17.1/lib/node_modules/aws-cdk/lib/index.js:443:10236)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack2 [as deployStack] (/Users/user/.nvm/versions/node/v18.17.1/lib/node_modules/aws-cdk/lib/index.js:446:153718)
    at async /Users/user/.nvm/versions/node/v18.17.1/lib/node_modules/aws-cdk/lib/index.js:446:137166

Reproduction Steps

(best way to reproduce would be to run into this yourself)
(one case: remove a resource that's needed by another stack)

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.93.0 (build 724bd01)

Framework Version

No response

Node.js Version

v18.17.1

OS

Mac OS 13.4

Language

Python

Language Version

Python (3.11)

Other information

No response

@gabriels1234 gabriels1234 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 29, 2023
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Aug 29, 2023
@peterwoodworth peterwoodworth added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Aug 29, 2023
@peterwoodworth
Copy link
Contributor

I think I know what you're describing - to see the errors you should be able to go to your CloudFormation stack in the console to view the error message in the events tab as a workaround.

The error message in the console is handled by the API call we make to CloudFormation, I'm not sure how easy it would be to make the message persist in the terminal, but it would certainly be helpful if the descriptive error never disappeared

@melhakim
Copy link

melhakim commented May 7, 2024

+1 on this one. There's also no log file in cdk.out that stores these error messages. I have to redeploy and quickly copy the error before it gets wiped off the terminal

@nmussy
Copy link
Contributor

nmussy commented May 7, 2024

I often end up going to the events tab of the CloudFormation web console to quickly identify which resource failed, and for what reason. This might be the best way to show this information (the resource name, type, event message) at the end of the deployment, followed by the stack trace

@melhakim
Copy link

melhakim commented May 7, 2024

Identifying the resource is just one step. But if you don't know why it is failing, debugging can be very difficult.

@ethyaan
Copy link

ethyaan commented Jul 9, 2024

this just started to happen to me.

@rix0rrr
Copy link
Contributor

rix0rrr commented Oct 18, 2024

Let's make 100% sure that the resource error is part of the exception that gets thrown. That way, there's no way it doesn't end up in the output.

@sumupitchayan
Copy link
Contributor

sumupitchayan commented Oct 21, 2024

I am unable to reproduce this bug - I tried by creating a CDK app with an S3 Bucket using a Bucket Name that already exists.

import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { Bucket } from 'aws-cdk-lib/aws-s3';

export class DeployErrorTestStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    new Bucket(this, 'my-bucket', {
      bucketName: 'bucket-name-that-already-exists'
    })
  }
}

After running cdk deploy, I was able to clearly see the resource handler error message in the terminal:

✨  Synthesis time: 3.95s

DeployErrorTestStack: start: Building 0efe21d033e1151a570dc1e09d865c2022f184180b86db587e0373f8f9be0baa:current_account-current_region
DeployErrorTestStack: success: Built 0efe21d033e1151a570dc1e09d865c2022f184180b86db587e0373f8f9be0baa:current_account-current_region
DeployErrorTestStack: start: Publishing 0efe21d033e1151a570dc1e09d865c2022f184180b86db587e0373f8f9be0baa:current_account-current_region
DeployErrorTestStack: success: Published 0efe21d033e1151a570dc1e09d865c2022f184180b86db587e0373f8f9be0baa:current_account-current_region
Stack undefined
DeployErrorTestStack: deploying... [1/1]
DeployErrorTestStack: creating CloudFormation changeset...
10:42:52 AM | CREATE_FAILED        | AWS::S3::Bucket    | mybucket15D133BF
Resource handler returned message: "source-bucket-groundtruth-56 already exists (Service: S3, Status Code: 0, Request ID: null)" (RequestToken: 8aa26f87-c710-a554-a7f7
-8006b151ab09, HandlerErrorCode: AlreadyExists)

❌  DeployErrorTestStack failed: The stack named DeployErrorTestStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource handler returned message: "source-bucket-groundtruth-56 already exists (Service: S3, Status Code: 0, Request ID: null)" (RequestToken: 8aa26f87-c710-a554-a7f7-8006b151ab09, HandlerErrorCode: AlreadyExists)

@gabriels1234 @ethyaan @melhakim can any of you confirm whether you still encounter this bug? It may have been fixed in a more recent CDK version.

@sumupitchayan sumupitchayan added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Oct 21, 2024
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. effort/medium Medium work item – several days of effort p1 package/tools Related to AWS CDK Tools or CLI response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

7 participants