aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.72k stars 3.94k forks source link

CDK bootstrap: does not create ECR repository #28876

Open argenstijn opened 10 months ago

argenstijn commented 10 months ago

Describe the bug

When i start CDK bootstrap

the repository with name 'cdk-hnb659fds-container-assets-XXXXXXXXXXX-eu-west-1' does not exist in the registry with id 'XXXXXXXX'

Why does CDK not create this resource by itself? And it's really needed. We don't use this registry?

We are using CDK version 2.122.0

Expected Behavior

CDK bootstrap upgraded the current one without any failures

Current Behavior

CDKToolkit | 13:18:14 | UPDATE_FAILED | AWS::ECR::Repository | ContainerAssetsRepository Resource handler returned message: "The repository with name 'cdk-hnb659fds-container-assets-XXXXXXXXXXX-eu-west-1' does not exist in the registry with id 'XXXXXXXXXX' (Service: Ecr, Status Code: 400, Request ID: dd8e5c15-471f-40e6-b66c-99089de92d7e)" (RequestToken: 5b5e2a1e-5f68-9ebb-ad24-c691481aa027, HandlerErrorCode: NotFound) ❌ Environment aws://XXXXXXXXXX/eu-west-1 failed bootstrapping: Error: The stack named CDKToolkit failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "The repository with name 'cdk-hnb659fds-container-assets-XXXXXXX-eu-west-1' does not exist in the registry with id 'XXXXXXXXXXXXX' (Service: Ecr, Status Code: 400, Request ID: dd8e5c15-471f-40e6-b66c-99089de92d7e)" (RequestToken: 5b5e2a1e-5f68-9ebb-ad24-c691481aa027, HandlerErrorCode: NotFound) at FullCloudFormationDeployment.monitorDeployment (c:\ontwikkel\tools\npm\prefix\node_modules\aws-cdk\lib\index.js:421:10615) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async c:\ontwikkel\tools\npm\prefix\node_modules\aws-cdk\lib\index.js:426:2104 at async Promise.all (index 0) at async CdkToolkit.bootstrap (c:\ontwikkel\tools\npm\prefix\node_modules\aws-cdk\lib\index.js:426:1949) at async exec4 (c:\ontwikkel\tools\npm\prefix\node_modules\aws-cdk\lib\index.js:479:53420)

The stack named CDKToolkit failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "The repository with name 'cdk-hnb659fds-container-assets-XXXXXXXX-eu-west-1' does not exist in the registry with id 'XXXXXXXXX' (Service: Ecr, Status Code: 400, Request ID: dd8e5c15-471f-40e6-b66c-99089de92d7e)" (RequestToken: 5b5e2a1e-5f68-9ebb-ad24-c691481aa027, HandlerErrorCode: NotFound)

Reproduction Steps

CDK bootstrap

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.122.0 (build 7e77e02)

Framework Version

2.122.0

Node.js Version

v20.11.0

OS

Windows 10

Language

Java

Language Version

Java 21

Other information

No response

argenstijn commented 10 months ago

Deleting the cloudformation stack and then perform CDK bootstrap worked!. Seems to be a bug!

pahud commented 10 months ago

Thank you for the report.

paulied67 commented 9 months ago

Deleting the cloudformation stack and then perform CDK bootstrap worked!. Seems to be a bug!

Which cloudformation stack did you delete?

github-actions[bot] commented 6 months ago

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

Boris344 commented 5 months ago

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

Please let the issue open, as I still encounter the problem; despite deleting the stack and bostrapping as previously advised.

unitypark commented 3 months ago

I can confirm that the issue exists still. ECR Repository Resource is actually defined in default bootstrapping cloudformation template, but the ECR Repository resource is not created. I had to create manually private repository 'cdk-{Qualifier}-container-assets-{AccountId}-{Region}' then it worked out. It was from my side actually Account Guardrail Setting that ECR Repository without KMS Encryption is not allowed to be created.

sylent-tech commented 2 months ago

I can confirm that the issue exists still. ECR Repository Resource is actually defined in default bootstrapping cloudformation template, but the ECR Repository resource is not created. I had to create manually private repository 'cdk-{Qualifier}-container-assets-{AccountId}-{Region}' then it worked out. It was from my side actually Account Guardrail Setting that ECR Repository without KMS Encryption is not allowed to be created.

seeing the same bug

bgiorgini commented 2 months ago

After deleting the Cloudformation stack, you might get a different error with the S3 bucket. Make sure you also delete the bucket before bootstrapping again.

CDKToolkit: creating CloudFormation changeset...
6:06:00 PM | CREATE_FAILED        | AWS::S3::Bucket         | StagingBucket

After deleting the Cloudformation stack and the bucket, right the cdk bootstrap command again. It worked for me.

❯ cdk --version
2.156.0 (build 2966832)
Shyam-Raghuwanshi commented 1 week ago

first, you need to delete the the cloudFormation then try cdk bootstrap