Hi there!
I am trying to deploy an EKS cluster via CDK Pipelines. This breaks, because the assets for custom resources within EKS are referenced with absolute path in ...assets.json. This happens during cdk synth in the Pipelines build step. Then, in a later pipeline step, cdk-assets is not able to find the assets (because CodeBuild generate random temp dir names for each run) and therefor uploads empty zip files to S3. This breaks the deployment of the application stack (eks) with this error message in CloudFormation:
Uploaded file must be a non-empty zip (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 6443c97c-4806-4f82-8224-5a4e2afc48b2; Proxy: null)
pipeline.addApplicationStage()cdk synth should create references with relative paths for the assets.
cdk synth creates references with absolute paths for the assets.
This is :bug: Bug Report
@tillkahlbrock It's not a general issue with CDK pipelines. I can deploy an EKS cluster with CDK pipelines successfully.
In my asset.json files, I can't see absolute paths.
{
"version": "7.0.0",
"files": {
"50e10880d134a01b440991fc77d217f39f01c2d56945215ee9a3b81187c6f3b1": {
"source": {
"path": "asset.50e10880d134a01b440991fc77d217f39f01c2d56945215ee9a3b81187c6f3b1",
"packaging": "zip"
},
I only saw absolute paths in the asset.json files if I specified it explicitly, e.g. cdk synth --no-staging.
Can you provide more information about your issue?
@jumi-dev thanks for the quick response. Regarding your questions:
Do the absolute paths only appear in the Codepipeline build? Or do they appear also if you run 'cdk synth' locally?
I have always absolute path, in CodeBuild and locally.
Which synth action are you using in the pipeline?
I copied this synth action from the DevGuide
synthAction: SimpleSynthAction.standardNpmSynth({
sourceArtifact,
cloudAssemblyArtifact,
// Use this if you need a build step (if you're not using ts-node
// or if you have TypeScript Lambdas that need to be compiled).
buildCommand: 'npm run build',
}),
When I understand the code correctly, it is doing npx cdk synth under the hood. This is what I am doing locally as well.
This does not seem to affect the main custom resources like "Custom::AWSCDK-EKS-*".
I can see the assets for OpenID Provider and "Custom::AWSCDKCfnJson" being rendered with absolute paths though.
This seems like a bug in https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/core/lib/custom-resource-provider/custom-resource-provider.ts#L143.
If I replace that line with fileName: staging.relativeStagedPath(stack) it works.
Paging @eladb @rix0rrr @jogold as you seem most familiar with the asset-staging and custom-resource-provider code.
@rix0rrr seems related to some recent change you worked on. What do you think?
I ran into this error as well while deploying an EdgeFunction with a CDK pipeline.
@bracki you are gold.
@rix0rrr you are welcome 馃槉 , thanks for the quick fix!
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Most helpful comment
@bracki you are gold.