Stop publishing the codegen node_modules - #30
Open
francoisferrand wants to merge 6 commits into
Open
francoisferrand wants to merge 6 commits into
francoisferrand wants to merge 6 commits into
Conversation
The 0.34.0 codegen pinned exact, now outdated @aws-sdk/* versions in the generated clients (@aws-sdk/core 3.856.0 brings a vulnerable fast-xml-parser). 0.54.0 emits a handful of caret ranges on current @aws-sdk/core and @smithy/core instead of ~40 packages. It is built against Smithy 1.73.0, so smithy-aws-traits (and the CLI used in CI) follows. The new schema-based serde reads error bodies itself and only surfaces a JSON SyntaxError for cloudserver's XML errors, so the custom error handler now sits inside the deserializer and maps XML/HTML error responses from the raw response. The generated *FilterSensitiveLog helpers are gone; nothing uses them. Issue: CLDSRVCLT-19
The package listed each typescript-codegen directory wholesale in `files`, so their node_modules got published too: ~400 MB installed, including build-only tools and an old @aws-sdk/core pulling a vulnerable fast-xml-parser. Consumers could not de-duplicate any of it, and yarn audit / osv did not see it either, only image scanners did. The generated clients now resolve their runtime dependencies from the root package.json, which declares them, and the package only ships each client's package.json and dist-* output. The build drops the nested node_modules once the clients are compiled so nothing resolves from there by accident. Issue: CLDSRVCLT-19
Packaging regressions have slipped through twice now: 1.0.10 shipped without the generated clients, 1.0.12 with their node_modules. Neither showed up in our tests, which run from the repository. CI now packs the build, rejects it if it contains node_modules, installs it in a scratch consumer with production dependencies only, and checks the package and each generated client load, can send a request and type-check. The release workflow runs the same check on the tarball it publishes. Issue: CLDSRVCLT-19
The generated clients load their dependencies from our package.json, and the set they need changes with the Smithy codegen version. A codegen bump that adds a dependency would otherwise only break consumers at runtime. The build now checks every dependency of the generated package.json files is declared at the root, and prints the `yarn add` line to fix it. Issue: CLDSRVCLT-19
Hello francoisferrand,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
francoisferrand
force-pushed
the
bugfix/CLDSRVCLT-19
branch
from
October 1, 2026 20:32
a831e8c to
373cce1
Compare
francoisferrand
marked this pull request as ready for review
October 1, 2026 20:32
The error middleware had to wrap the deserializer and rebuild exceptions by hand from the raw response. Parsing these bodies in the protocol instead hands them to the SDK's own error handling, so modeled errors come back as their generated classes with their header members, the same as for JSON responses. createCustomErrorMiddleware is removed: nothing outside this package uses it. Issue: CLDSRVCLT-19
francoisferrand
force-pushed
the
bugfix/CLDSRVCLT-19
branch
from
October 2, 2026 13:47
373cce1 to
285f806
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
| npm install --omit=dev --ignore-scripts --no-audit --no-fund --silent "$TARBALL" | ||
| node smoke.js | ||
|
|
||
| npm install --no-save --ignore-scripts --no-audit --no-fund --silent typescript @types/node@20 |
Contributor
There was a problem hiding this comment.
Should this be node@24 ? And so in package json also node >= 24
SylvainSenechal
approved these changes
Oct 2, 2026
SylvainSenechal
left a comment
Contributor
There was a problem hiding this comment.
Should we consider node >= 24 instead of 20 ?
The last commit says release 1.1.13, but the code bumps to 1.0.13 and the targeted branch is dev/1.0, I think we wanna go with 1.1.13, right ?
Issue: CLDSRVCLT-19
francoisferrand
force-pushed
the
bugfix/CLDSRVCLT-19
branch
from
October 2, 2026 18:46
285f806 to
fb6dd25
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1.0.12 publishes each Smithy
typescript-codegendirectory wholesale, including itsnode_modules. That comes to ~400 MB installed, with build-only tools and an old@aws-sdk/corethat brings a vulnerable fast-xml-parser. Consumers (cloudserver, backbeat) can't de-duplicate any of it, and only image scanners like trivy notice it.What changes:
@aws-sdk/coreand@smithy/core, instead of ~40 exact, outdated pins. The new serde no longer keeps error bodies, so the custom error handler now sits inside the deserializer. It turns cloudserver's XML errors and the S3C proxy's HTML errors into exceptions using the raw response.package.json, and the package only ships each client'spackage.jsonanddist-*. No morenode_modules.node_modulesin the tarball, and installs it into a scratch consumer with prod deps only. It then checks that the package and each generated client load, send a request and type-check. The release workflow runs the same check on the tarball it publishes.Local results:
trivy reports no findings on the installed consumer after the change.
The version isn't bumped here. Once this lands, releasing 1.0.13 and bumping it in cloudserver and backbeat will remove the nested trees from their images.
Issue: CLDSRVCLT-19