custom-resources integ tests failing
See original GitHub issueyarn integ
currently fails in the @aws-cdk/custom-resources
module with a cloudformation error.
Reproduction Steps
yarn install
cd packages/@aws-cdk/custom-resources
../../../scripts/buildup
yarn run integ
Error Log
5/9 | 9:09:36 PM | CREATE_FAILED | AWS::Lambda::Function | AWS679f53fac002430cb0da5b7982bd2287 (AWS679f53fac002430cb0da5b7982bd22872D164C4C) Uploaded file must be a non-empty zip (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 7ad19cda-8432-4743-8473-7f4b292b8003)
new Function (/Users/valinm/dev/aws-cdk/packages/@aws-cdk/aws-lambda/lib/function.js:71:26)
\_ SingletonFunction.ensureLambda (/Users/valinm/dev/aws-cdk/packages/@aws-cdk/aws-lambda/lib/singleton-lambda.js:37:16)
\_ new SingletonFunction (/Users/valinm/dev/aws-cdk/packages/@aws-cdk/aws-lambda/lib/singleton-lambda.js:19:36)
\_ new AwsCustomResource (/Users/valinm/dev/aws-cdk/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.js:102:26)
\_ Object.<anonymous> (/Users/valinm/dev/aws-cdk/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js:11:20)
\_ 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)
\_ startup (internal/bootstrap/node.js:283:19)
\_ bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Environment
- **CLI Version : 1.27.0 (current master)
- **Framework Version: 1.27.0 (current master)
- **OS : MacOS 10.14
- **Language : Typescript
Other
As far as I can tell, the code in custom-resources where this is coming from is pointing to an asset that has valid content. This could be an issue with assets.
recent assets change though not immediately clear if this is causing this. https://github.com/aws/aws-cdk/commit/d5575926b25cf0df8ea651041c426814153b6647
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (17 by maintainers)
Top Results From Across the Web
CDK Integration Testing | Ben's Blog
Running integration tests in a CloudFormation custom resource simplifies a few of these issues. You can use references to other resources in ...
Read more >Integration test in custom folder: Execution failed for task
I have a SpringBoot project with Grails build, with the following structure: mybike-rest src integration java com.bike ...
Read more >How to Fix Flaky Tests - Semaphore CI
Flaky tests hinder development, slow down progress, hide design problems, and can cost a lot of money in the long run.
Read more >aws-cdk/custom-resources module - AWS Documentation
Handling Custom Resource Errors. Every error produced by the API call is treated as is and will cause a "FAILED" response to be...
Read more >Automatic AWS CloudFormation rollbacks upon a test failure ...
Writing end-to-end and integration tests to ensure the different services ... Using the AWS CloudFormation Custom resource Lambda Function.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for debugging @jogold !
The problem is here: https://github.com/aws/aws-cdk/blob/8da9e1eb07e5cc60b421112df543b4bb9db703e8/packages/cdk-assets/lib/private/handlers/files.ts#L58
Here
this.workDir
iscdk.out
andthis.asset.source.path
is an absolute path to the asset. This result in a non-existant path and an empty zip file uploaded to S3.The
cdk.out
comes from herestack.assembly.directory
: https://github.com/aws/aws-cdk/blob/8da9e1eb07e5cc60b421112df543b4bb9db703e8/packages/aws-cdk/lib/api/deploy-stack.ts#L132I would say that using
this.asset.source.path
incdk-assets/lib/private/handlers/files.ts
would fix this since it’s an absolute path already… but from the JSDoc it’s expected to be relative…Note also that once you deployed it with an empty zip file it will always reuse that empty file unless you manually remove it from S3. https://github.com/aws/aws-cdk/blob/8da9e1eb07e5cc60b421112df543b4bb9db703e8/packages/cdk-assets/lib/private/handlers/files.ts#L38-L41
@rix0rrr