Skip to content

Upgrade AWS SDK from v2 to v3 in browser release script#1350

Merged
mschasz merged 2 commits intomasterfrom
aws-upgrade
Mar 5, 2026
Merged

Upgrade AWS SDK from v2 to v3 in browser release script#1350
mschasz merged 2 commits intomasterfrom
aws-upgrade

Conversation

@mschasz
Copy link
Copy Markdown
Collaborator

@mschasz mschasz commented Mar 5, 2026

Summary

  • Replace deprecated aws-sdk (v2) with modular @aws-sdk/client-s3 (v3) in the CDN release script
  • Update import pattern to use v3's destructured imports (S3Client, PutObjectCommand)
  • Migrate credential configuration to v3's nested credentials object pattern
  • Convert putObject().promise() calls to v3's command pattern: send(new PutObjectCommand())

Why

AWS SDK v2 for JavaScript is deprecated and scheduled for end-of-life. The v3 SDK provides:

  • Modular architecture (only install what you need)
  • Smaller bundle size
  • Better TypeScript support
  • Improved middleware stack

Test plan

  • Verified syntax with node -c scripts/release.js
  • All 68 test suites pass (750 tests)
  • TypeScript compilation succeeds
  • Manual testing of CDN release in staging environment (requires AWS credentials)

Parameter Compatibility Verified

All S3 parameters used are compatible between v2 and v3:

  • Bucket, Key, Body, GrantRead, ContentType, CacheControl, ContentEncoding

No Breaking Changes

  1. Published package unaffected - AWS SDK is a devDependency only, used for internal CDN release script
  2. End users unaffected - No changes to the library's public API or runtime dependencies
  3. Behavior identical - Same files uploaded to same S3 paths with same metadata

Verification Passed

  • ✅ JavaScript syntax validation
  • ✅ All required modules available
  • ✅ PutObjectCommand accepts all parameters
  • ✅ TypeScript compilation succeeds
  • ✅ All 750 tests pass
  • ✅ All CI checks pass (Buildkite, Codecov, Semgrep, OPA)

No breaking changes introduced. Existing functionality is fully preserved. The upgrade is a drop-in replacement that maintains identical behavior while modernizing from the deprecated AWS SDK v2 to v3.

Replace deprecated aws-sdk (v2) with modular @aws-sdk/client-s3 (v3)
in the CDN release script. This upgrade:

- Updates import from aws-sdk/clients/s3 to @aws-sdk/client-s3
- Migrates to v3's credential configuration pattern
- Converts putObject().promise() calls to send(new PutObjectCommand())
- Reduces bundle size by using modular client instead of full SDK

AWS SDK v2 is deprecated and scheduled for end-of-life.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 5, 2026

🦋 Changeset detected

Latest commit: 38070dd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@segment/analytics-next Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.32%. Comparing base (fa58aa2) to head (38070dd).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1350   +/-   ##
=======================================
  Coverage   91.32%   91.32%           
=======================================
  Files         163      163           
  Lines        4393     4393           
  Branches     1052     1052           
=======================================
  Hits         4012     4012           
  Misses        381      381           
Flag Coverage Δ
browser 92.23% <ø> (ø)
core 90.16% <ø> (ø)
node 88.52% <ø> (ø)

☔ 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.

@mschasz mschasz merged commit d41ca13 into master Mar 5, 2026
6 checks passed
@mschasz mschasz deleted the aws-upgrade branch March 5, 2026 17:29
@github-actions github-actions bot mentioned this pull request Mar 5, 2026
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.

2 participants