Skip to content

Migrate lib/upload-s3.js from AWS SDK v2 to v3 (lib-storage Upload) - #84

Open
Riarstudio wants to merge 1 commit into
jameshy:masterfrom
Riarstudio:aws-sdk-v3-migration
Open

Riarstudio wants to merge 1 commit into
jameshy:masterfrom
Riarstudio:aws-sdk-v3-migration

Conversation

@Riarstudio

@Riarstudio Riarstudio commented Oct 12, 2026 •

Copy link
Copy Markdown

Fixes #83.

What

Migrates the S3 upload path from AWS SDK for JavaScript v2 to v3. AWS SDK v2 reached
end-of-support on September 8, 2025 and receives no security patches (advisory
GHSA-j965-2qgj-vjmq, applies to all v2 versions; remediation is migration to v3).

Changes

  • lib/upload-s3.js — new AWS.S3({ region }) becomes new S3Client({ region, logger })
    from @aws-sdk/client-s3 (the v2 global AWS.config.update({ logger }) moves into the
    client constructor). The managed upload s3.upload(params, { partSize, queueSize: 1 }).promise()
    becomes new Upload({ client, params, partSize, queueSize: 1 }).done() from
    @aws-sdk/lib-storage — same multipart behavior, same options, stream Body unchanged.
  • package.json — adds @aws-sdk/client-s3 and @aws-sdk/lib-storage. aws-sdk is
    kept: lib/iam.js and lib/secrets-manager.js still use it and are out of scope here.

Verification

  • Deterministic rule-pack validation passed; patch applies cleanly against
    07de5cc; preservation check passed; patched tree re-validated.
  • npm install passed in our verification sandbox (registry egress).
  • npm test currently fails on unmodified master at test-harness load:
    test/handler.js calls chai.use(...) and throws TypeError: fn is not a function with the repo's pinned chai/chai-as-promised versions. We
    reproduced the identical failure on the unpatched tree in the same
    sandbox, so it is pre-existing and unrelated to this change — but it does
    mean the suite could not exercise the migrated code. The change is
    confined to lib/upload-s3.js and is a mechanical equivalent of the
    previous implementation.
  • npx eslint . reports pre-existing findings across the repo (including
    files this PR doesn't touch); the migrated file matches the repo's
    existing style.

AWS SDK for JavaScript v2 reached end-of-support on September 8, 2025
and receives no security patches (GHSA-j965-2qgj-vjmq). Replace the
v2 managed upload s3.upload(...).promise() with the Upload class
from @aws-sdk/lib-storage (same partSize/queueSize options) driven
by an S3Client from @aws-sdk/client-s3; the logger config moves
into the client constructor. package.json: add @aws-sdk/client-s3
and @aws-sdk/lib-storage; aws-sdk stays for lib/iam.js and
lib/secrets-manager.js, which are out of scope.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate S3 upload path from AWS SDK v2 (end-of-life, no security patches) to v3

1 participant