Skip to content

Upgrade aws-sdk v2 to @aws-sdk/client-s3 v3 #844

Open
AnkitSegment wants to merge 2 commits intomasterfrom
aws-upgrade
Open

Upgrade aws-sdk v2 to @aws-sdk/client-s3 v3 #844
AnkitSegment wants to merge 2 commits intomasterfrom
aws-upgrade

Conversation

@AnkitSegment
Copy link
Contributor

Summary

  • Migrate scripts/upload-assets.js from the monolithic aws-sdk v2 to the modular @aws-sdk/client-s3 v3 package
  • Reduces devDependency footprint by only installing the S3 client module instead of the entire AWS SDK
  • Pin to @aws-sdk/client-s3@3.722.0, the last version supporting the repo's Node 16 runtime

Changes

scripts/upload-assets.js

  • Replace require('aws-sdk/clients/s3') with const { S3Client, PutObjectCommand } = require('@aws-sdk/client-s3')
  • Use new S3Client({ region, credentials: { ... } }) instead of new S3({ accessKeyId, secretAccessKey, sessionToken, region })
  • Replace s3.putObject(params).promise() with s3.send(new PutObjectCommand(params)) throughout (putObject helper + 2 manifest uploads)

package.json

  • Replace "aws-sdk": "^2.760.0" with "@aws-sdk/client-s3": "3.722.0" in devDependencies

Test Screenshot

The uploadAssets function is used by makefile, when it calls new version of build get uploaded in s3.
Staging commit hash SHA: 532ade6
CDN link: https://cdn.segment.build/next-integrations/manifest-532ade6.json

S3 file update.

Screenshot 2026-02-13 at 2 44 35 PM

Test plan

  • node -c scripts/upload-assets.js — syntax check passes
  • SDK v3 imports and instantiation verified at runtime on Node 16.20.2
  • S3Client, PutObjectCommand, and client.send() all functional
  • yarn test passes (no integration tests affected — this is a build-only script)
  • All PutObjectCommand parameters (Bucket, Key, Body, ContentType, GrantRead, GrantFullControl, ContentEncoding, CacheControl) are identical between v2 and v3 APIs

🤖 Generated with Claude Code

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.

3 participants