Skip to content

[@aws-cdk/aws-codecommit]: Repo can't find s3 bucket when deployed. #16958

@fsmikedev

Description

@fsmikedev

What is the problem?

I'm trying to create a codecommit repo with the contents of an s3 bucket.

Reproduction Steps

    const bucket = new s3.Bucket(this, `bucket-${account}`, {
      bucketName: `bucket-${account}`,
      autoDeleteObjects: true,
      publicReadAccess: true,
      removalPolicy: cdk.RemovalPolicy.DESTROY,
    });

    const bucketDeploy = new s3deploy.BucketDeployment(this, `bucket-deploy-${account}`, {
      sources: [s3deploy.Source.asset(path.join(__dirname, "tmp"))],
      destinationBucket: bucket,
      destinationKeyPrefix: "test",
    });

    const repo = new codecommit.CfnRepository(this, "test-repo", {
      repositoryName: "test-repo",
      code: {
        branchName: "main",
        s3: {
          bucket: `bucket-${account}`,
          key: "test",
        },
      },
    });

    repo.node.addDependency(bucketDeploy);

What did you expect to happen?

The test repo would have contents deployed from the s3 bucket.

What actually happened?

An error when cdk deploy is called.

51/55 | 18:40:00 | CREATE_FAILED | AWS::CodeCommit::Repository | test-repo/test-repo (testrepoCE419A0A) Not Found (Service: Amazon S3; Status Code: 404; Error Code: 404 Not Found

CDK CLI Version

1.127.0

Framework Version

No response

Node.js Version

14.17.1

OS

Windows 10

Language

Typescript

Language Version

4.4.3

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-codecommitRelated to AWS CodeCommitbugThis issue is a bug.closed-for-stalenessThis issue was automatically closed because it hadn't received any attention in a while.p2response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions