aws-cdk: Custom::CDKBucketDeployment failed to create
-
I’m submitting a …
- 🪲 bug report
- 🚀 feature request
- 📚 construct library gap
- ☎️ security issue or vulnerability => Please see policy
- ❓ support request => Please see note at the top of this template.
-
What is the current behavior? If the current behavior is a 🪲bug🪲: Please provide the steps to reproduce
I’m using a Custom::CDKBucketDeployment resource to deploy a static website to a S3 bucket:
// A CDK helper that takes the defined source directory, compresses it, and uploads it to the destination s3 bucket.
new s3deploy.BucketDeployment(this, "DeployWebsite", {
source: s3deploy.Source.asset(webAppRoot),
destinationKeyPrefix: "web/",
destinationBucket: bucket,
retainOnDelete: false
});
When running the cdk deploy command this fails with:
9/10 | 3:50:56 PM | CREATE_FAILED | Custom::CDKBucketDeployment | DeployWebsite/CustomResource/Default (DeployWebsiteCustomResourceD116527B) Failed to create resource. Command '['python3', '/var/task/aws', 's3', 'cp', 's3://cdktoolkit-stagingbucket-198n7ki0ng3ti/assets/MythicalMysfitsWebsiteDeployWebsiteAsset1A926195/2299535aebe61fbe992dffa2c950144f29f963029c9a5b7758b93409fd4e379a.zip', '/tmp/tmpfxnjcuck/archive.zip']' returned non-zero exit status 1.
new CustomResource (/home/ec2-user/environment/workshop/cdk/node_modules/@aws-cdk/aws-cloudformation/lib/custom-resource.ts:92:21)
\_ new BucketDeployment (/home/ec2-user/environment/workshop/cdk/node_modules/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts:89:5)
\_ new WebApplicationStack (/home/ec2-user/environment/workshop/cdk/lib/web-application-stack.ts:50:5)
\_ Object.<anonymous> (/home/ec2-user/environment/workshop/cdk/bin/cdk.ts:7:1)
\_ Module._compile (internal/modules/cjs/loader.js:776:30)
\_ Module.m._compile (/home/ec2-user/environment/workshop/cdk/node_modules/ts-node/src/index.ts:473:23)
\_ Module._extensions..js (internal/modules/cjs/loader.js:787:10)
\_ Object.require.extensions.(anonymous function) [as .ts] (/home/ec2-user/environment/workshop/cdk/node_modules/ts-node/src/index.ts:476:12)
\_ Module.load (internal/modules/cjs/loader.js:653:32)
\_ tryModuleLoad (internal/modules/cjs/loader.js:593:12)
\_ Function.Module._load (internal/modules/cjs/loader.js:585:3)
\_ Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
\_ Object.<anonymous> (/home/ec2-user/environment/workshop/cdk/node_modules/ts-node/src/bin.ts:158:12)
\_ Module._compile (internal/modules/cjs/loader.js:776:30)
\_ Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
\_ Module.load (internal/modules/cjs/loader.js:653:32)
\_ tryModuleLoad (internal/modules/cjs/loader.js:593:12)
\_ Function.Module._load (internal/modules/cjs/loader.js:585:3)
\_ Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
\_ findNodeScript.then.existing (/home/ec2-user/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/libnpx/index.js:268:14)
-
What is the expected behavior (or behavior of feature suggested)? Expected behavior is that the static website content is deployed onto the S3 bucket.
-
What is the motivation / use case for changing the behavior or adding this feature? N/A
-
Please tell us about your environment:
- CDK CLI Version: 1.4.0
- Module Version: 1.4.0
- OS: all
- Language: TypeScript (but I expect all to be affected)
-
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)
- Downgrading the @aws-cdk/aws-s3-deployment module to version 1.3.0 fixes the issue.
- The full code I’m using is at https://github.com/aws-samples/aws-modern-application-workshop/tree/python-cdk/module-1/cdk
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 16 (11 by maintainers)
Commits related to this issue
- fix(s3-deployment): custom resource fails to run aws-cli Due to a change in our build environment (superchain) to Amazon Linux, the structure of the python modules installed in the s3 deployment cust... — committed to aws/aws-cdk by deleted user 5 years ago
- Updates S3 deployment to invalidate CF caches. Needs fix for https://github.com/aws/aws-cdk/issues/3656 — committed to dstroppa/aws-modern-application-workshop by deleted user 5 years ago
- fix(s3-deployment): custom resource fails to run aws-cli (#3668) * fix(s3-deployment): custom resource fails to run aws-cli Due to a change in our build environment (superchain) to Amazon Linux, th... — committed to aws/aws-cdk by deleted user 5 years ago
@eladb any plans for a v1.4.1 with this fix?
Confirming this is a bug, we have a repro.
I’m also experiencing this in 1.4.0 and it was previously working when I used 1.3.0. Gonna investigate.
After investigating, it seems like the biggest change to the
CDKBucketDeploymentwas https://github.com/aws/aws-cdk/pull/3213. Nothing in that PR stood out to me though. For now I just went back to 1.3 and was able to deploy again.@KnisterPeter 1.5.0 was merged in (https://github.com/aws/aws-cdk/commit/c020efa2c21bcc7411c06640ada627b06fa86390) so I"m sure that release will come out shortly.
Edit: And it’s live 🎉