Skip to content

fix(cdk-assets): fails installation when new dependencies are released #603

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

Merged
merged 3 commits into from
Jun 24, 2025

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Jun 12, 2025

Because cdk-assets CLI depends on floating versions of dependencies, it may break when new 3rd party dependencies are released, or when it is installed just around the time a new version of AWS SDKv3 gets released (because that has hundreds of packages that all refer to each other by specific version, but they're subject to publishing/replication latency so they don't all become instantaneously available).

We used to generate a shrinkwrap file for the cdk-assets CLI but apparently that didn't work because we're still getting reports of breakage.

Instead, we'll resort to bundling the dependencies of cdk-assets into the CLI itself, so it cannot go wrong.

Because the cdk-assets package does double duty as a CLI package as well as a library package, we can't just naively stick the BundleCli job onto the package: doing that would remove all the bundled dependencies from the package.json list, which breaks its function as a library.

Instead, we're splitting the cdk-assets package in two:

  • cdk-assets: will continue to contains the CLI, which will be bundled
  • @aws-cdk/cdk-assets-lib: the core portion of the assets publishing, available as a library.

Because cdk-assets can no longer be used as a library, we have bumped the major version to 4 to indicate this change in API surface. In CDK pipelines we install cdk-assets@latest, so it will automatically pick up major version 4 once released.

(While this PR is strictly speaking a breaking change, I'm not adding any "breaking change" markers into the PR description, because this is changing many files across multiple packages, and I don't trust the automatic major version bumping script to not accidentally MV bump something I didn't intend to)


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@rix0rrr rix0rrr requested a review from a team June 12, 2025 07:59
@rix0rrr rix0rrr temporarily deployed to integ-approval June 12, 2025 07:59 — with GitHub Actions Inactive
@github-actions github-actions bot added the p2 label Jun 12, 2025
@rix0rrr
Copy link
Contributor Author

rix0rrr commented Jun 12, 2025

Relates to #597

@aws-cdk-automation aws-cdk-automation requested a review from a team June 12, 2025 08:00
@codecov-commenter
Copy link

codecov-commenter commented Jun 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.01%. Comparing base (9d2fff5) to head (73c73a1).
⚠️ Report is 74 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #603   +/-   ##
=======================================
  Coverage   79.01%   79.01%           
=======================================
  Files          46       46           
  Lines        7085     7085           
  Branches      791      791           
=======================================
  Hits         5598     5598           
  Misses       1468     1468           
  Partials       19       19           
Flag Coverage Δ
suite.unit 79.01% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rix0rrr rix0rrr force-pushed the huijbers/bundle-cdk-assets branch from c5ebd30 to ab2764e Compare June 12, 2025 12:47
@rix0rrr rix0rrr temporarily deployed to integ-approval June 12, 2025 12:47 — with GitHub Actions Inactive
@rix0rrr rix0rrr force-pushed the huijbers/bundle-cdk-assets branch from ab2764e to ba8482e Compare June 12, 2025 12:51
@rix0rrr rix0rrr force-pushed the huijbers/bundle-cdk-assets branch from ba8482e to 05e1785 Compare June 12, 2025 12:53
Signed-off-by: github-actions <[email protected]>
@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Jun 24, 2025
Merged via the queue into main with commit 6625d97 Jun 24, 2025
44 of 46 checks passed
@aws-cdk-automation aws-cdk-automation deleted the huijbers/bundle-cdk-assets branch June 24, 2025 12:05
github-merge-queue bot pushed a commit that referenced this pull request Jun 27, 2025
…a program (#661)

Ever since #603, the file
references an external package that is not installed during installation
of `cdk-assets`. This causes:

```console
Error: Cannot find module '@aws-cdk/cdk-assets-lib'
Require stack:
- /usr/local/lib/node_modules/cdk-assets/bin/docker-credential-cdk-assets.js
- /usr/local/lib/node_modules/cdk-assets/bin/docker-credential-cdk-assets
    at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
    at Module._load (node:internal/modules/cjs/loader:981:27)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/cdk-assets/bin/docker-credential-cdk-assets.js:16:26)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/cdk-assets/bin/docker-credential-cdk-assets.js',
    '/usr/local/lib/node_modules/cdk-assets/bin/docker-credential-cdk-assets'
  ]
}
```

To fix, lets bundle this script as well (in addition to the standard
`cdk-assets` entrypoint).

---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license

---------

Signed-off-by: github-actions <[email protected]>
Co-authored-by: github-actions <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants