aws / aws/aws-cdk

(aws-s3-deployment): s3 sync error

Open
#18,421 14 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-s3-deployment bug effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
71

Description

### What is the problem?

I'm getting errors deploying a CloudFront bucket. I notice that the bucket is being created and data is uploaded but the error still shows up triggering a rollback.

### Reproduction Steps

```ts
const bucket = new s3.Bucket(this, `${app.name}-deployment-bucket`, {
bucketName: `web-assets`,
websiteIndexDocument: "index.html",
websiteErrorDocument: "index.html",
publicReadAccess: false,
removalPolicy: cdk.RemovalPolicy.DESTROY,
encryption: s3.BucketEncryption.S3_MANAGED,
enforceSSL: true,
});

new s3deploy.BucketDeployment(this, `deploy-with-invalidation-${app.name}`, {
sources: [
s3deploy.Source.asset(app.path, {
assetHash: crypto.createHash("sha256").digest("hex"), // enforce update on every deployment
}),
],
destinationBucket: bucket,
destinationKeyPrefix: `apps/${app.name}/`,
distribution: aws_cloudfront.Distribution.fromDistributionAttributes(this, "simulator-distribution", {
distributionId: "abc",
domainName: "abc",
}),
distributionPaths: ["/*"],
});
```

### What did you expect to happen?

sync

### What actually happened?

```sh
21:17:06 | UPDATE_FAILED | Custom::CDKBucketDeployment | deploy-with-invali...omResource/Default
Received response status [FAILED] from custom resource. Message returned: Command '['/opt/awscli/aws', 's3', 'sync', '--delete', '/tmp/tmpe2v7wyd5/contents', 's3://web-assets/web/']' returned non
-zero exit status 1. (RequestId: 0b5def67-e700-4ee0-962f-306109d8a1a5)
```

### CDK CLI Version

version 2.8.0

### Framework Version

_No response_

### Node.js Version

14.17.1

### OS

linux

### Language

Typescript

### Language Version

_No response_

### Other information

https://github.com/aws/aws-cdk/issues/13292

Contributor guide

Open the contributing guide

Research direction

Start with s3deploy.BucketDeployment and its Custom::CDKBucketDeployment resource, then reproduce the AWS CLI `s3 sync` failure using the TypeScript example and the reported CDK CLI version. Compare the behavior with issue 13292 and verify that a successful deployment no longer triggers rollback.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.