Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipelines: failed to upload stage assets: Cloud assembly schema version mismatch #32744

Closed
1 task done
Tietew opened this issue Jan 6, 2025 · 8 comments
Closed
1 task done
Assignees
Labels
@aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. management/tracking Issues that track a subject or multiple issues p0 potential-regression Marking this issue as a potential regression to be checked by team member

Comments

@Tietew
Copy link
Contributor

Tietew commented Jan 6, 2025

Please add your +1 👍 to let us know you have encountered this

Status: RESOLVED

Overview:

CDK pipelines are failing to publish assets created by CDK version 2.174.0 due to a schema version mismatch error.

Complete Error Message:

Error: Canot read asset manifest 'assembly-StackName-StageName/xxxxxxxx.assets.json': Cloud assembly schema version mismatch: Maximum schema version supported is 38.x.x, but found 39.0.0

Workaround:

Revert aws-cdk-lib to version 2.173.4 or less.

Solution:

No action needed. Rerunning the pipeline should now install [email protected] (at least), which supports schema version 39 and successfully publish the assets.


original post

Describe the bug

I have a CodePipeline built by CDK pipelines aws-cdk-lib/pipelines.
After upgrading CDK 2.174.0, action FileAsset failed with following error message:

Error: Canot read asset manifest 'assembly-StackName-StageName/xxxxxxxx.assets.json': Cloud assembly schema version mismatch: Maximum schema version supported is 38.x.x, but found 39.0.0

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

2.173.2

Expected Behavior

FileAsset action uploads assets for my stage.

Current Behavior

Build log: (some words are masked)

[Container] 2025/01/06 06:20:17.234247 Entering phase INSTALL
[Container] 2025/01/06 06:20:17.276438 Running command npm install -g cdk-assets@latest

added 114 packages in 12s

24 packages are looking for funding
  run `npm fund` for details

[Container] 2025/01/06 06:20:35.713480 Phase complete: INSTALL State: SUCCEEDED
[Container] 2025/01/06 06:20:35.713521 Phase context status code:  Message: 
[Container] 2025/01/06 06:20:35.753632 Entering phase PRE_BUILD
[Container] 2025/01/06 06:20:35.755169 Phase complete: PRE_BUILD State: SUCCEEDED
[Container] 2025/01/06 06:20:35.755184 Phase context status code:  Message: 
[Container] 2025/01/06 06:20:35.795870 Entering phase BUILD
[Container] 2025/01/06 06:20:35.797049 Running command cdk-assets --path "assembly-StackName-StageName/xxxxxxxxxx.assets.json" --verbose publish "xxxxxxxx:xxxxxxxx-ap-northeast-1"
Error: Canot read asset manifest 'assembly-StackName-StageName/xxxxxxxxxx.assets.json': Cloud assembly schema version mismatch: Maximum schema version supported is 38.x.x, but found 39.0.0
    at AssetManifest.fromFile (/usr/local/lib/node_modules/cdk-assets/lib/asset-manifest.js:20:19)
    at AssetManifest.fromPath (/usr/local/lib/node_modules/cdk-assets/lib/asset-manifest.js:39:30)
    at publish (/usr/local/lib/node_modules/cdk-assets/bin/publish.js:7:40)
    at /usr/local/lib/node_modules/cdk-assets/bin/cdk-assets.js:39:37
    at Object.handler (/usr/local/lib/node_modules/cdk-assets/bin/cdk-assets.js:62:15)
    at Object.runCommand (/usr/local/lib/node_modules/cdk-assets/node_modules/yargs/build/index.cjs:446:48)
    at Object.parseArgs [as _parseArgs] (/usr/local/lib/node_modules/cdk-assets/node_modules/yargs/build/index.cjs:2697:57)
    at Object.get [as argv] (/usr/local/lib/node_modules/cdk-assets/node_modules/yargs/build/index.cjs:2651:25)
    at main (/usr/local/lib/node_modules/cdk-assets/bin/cdk-assets.js:49:31)
    at Object.<anonymous> (/usr/local/lib/node_modules/cdk-assets/bin/cdk-assets.js:65:1)

[Container] 2025/01/06 06:20:35.982156 Command did not exit successfully cdk-assets --path "assembly-StackName-StageName/xxxxxxxxxx.assets.json" --verbose publish "xxxxxxxx:xxxxxxxx-ap-northeast-1" exit status 1
[Container] 2025/01/06 06:20:35.986643 Phase complete: BUILD State: FAILED

The latest cdk-assets seems not to support cloud assembly schema v39.

Reproduction Steps

Build a CDK pipeline CodePipeline and deploy it.

const pipeline = new pipelines.CodePipeline(this, 'Pipeline', {
  synth: new pipelines.ShellStep('Synth', {
    input: pipelines.CodePipelineSource.connection('repo/name', 'main', { connectionArn }),
    installCommands: ['yarn install'],
    commands: ['cdk synth'],
    primaryOutputDirectory: 'cdk.out',
  }),
});
pipeline.addStage(new MyStage(this, 'MyStage'));
pipeline.buildPipeline();

Possible Solution

cdk-assets v3.0.0-rc.111 may support v39.
But the install command npm install -g cdk-assets@latest is hardcoded here

installCommands: [
'npm install -g cdk-assets@latest',
],

Additional Information/Context

No response

CDK CLI Version

2.174.0

Framework Version

No response

Node.js Version

CodeBuild default

OS

CodeBuild Linux container

Language

TypeScript

Language Version

No response

Other information

No response

@Tietew Tietew added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 6, 2025
@github-actions github-actions bot added potential-regression Marking this issue as a potential regression to be checked by team member @aws-cdk/pipelines CDK Pipelines library labels Jan 6, 2025
@joostvanderborg
Copy link

Specifically this PR seems to introduce the regression: #32704
This, combined with the pipeline asset stage using latest (see above).

Currently, this breaks all our pipelines.

@Isampath89
Copy link

Installing a pre-release version fixed the issue temporarily. Hopefully it will be released soon as the latest.
npm install -g [email protected]

@ashishdhingra ashishdhingra self-assigned this Jan 6, 2025
@ashishdhingra ashishdhingra added p1 needs-reproduction This issue needs reproduction. and removed needs-triage This issue or PR still needs to be triaged. labels Jan 6, 2025
@Schwartz-Matthew-bah
Copy link

we are also seeing this after updating dependencies today

@Dror-Bar
Copy link

Dror-Bar commented Jan 6, 2025

Also experiencing it here, does anyone know a workaround?

@iliapolo iliapolo added the p0 label Jan 6, 2025
@ashishdhingra
Copy link
Contributor

From issue description:

cdk-assets v3.0.0-rc.111 may support v39.
But the install command npm install -g cdk-assets@latest is hardcoded here

installCommands: [
'npm install -g cdk-assets@latest',
],

npm install -g cdk-assets@latest would install latest stable version rather than preview version which might support v39.

@ashishdhingra ashishdhingra removed p1 needs-reproduction This issue needs reproduction. labels Jan 6, 2025
@iliapolo
Copy link
Contributor

iliapolo commented Jan 6, 2025

This is because we didn't bump the dependency in the 2.x version of line of cdk-assets. Working on it.

github-merge-queue bot pushed a commit to cdklabs/cdk-assets that referenced this issue Jan 6, 2025
Backport of #277. 

CDK pipeliens use `npm install -g cdk-assets@latest` to grab a version
of `cdk-assets`, but since the 3.x version line is still an RC, the
`latest` tag still points to the `2.x` version line.

Fixes aws/aws-cdk#32744

---------

Signed-off-by: github-actions <[email protected]>
Co-authored-by: github-actions <[email protected]>
@iliapolo
Copy link
Contributor

iliapolo commented Jan 6, 2025

With the release of https://www.npmjs.com/package/cdk-assets/v/2.155.82, this should be fixed now.

@iliapolo iliapolo closed this as completed Jan 6, 2025
Copy link

github-actions bot commented Jan 6, 2025

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 6, 2025
@iliapolo iliapolo added the management/tracking Issues that track a subject or multiple issues label Jan 6, 2025
@iliapolo iliapolo pinned this issue Jan 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. management/tracking Issues that track a subject or multiple issues p0 potential-regression Marking this issue as a potential regression to be checked by team member
Projects
None yet
Development

No branches or pull requests

7 participants