Upgrade aws-sdk v2 to @aws-sdk/client-s3 v3 - #853
AnkitSegment wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Migrate the asset upload script from AWS SDK v2 (aws-sdk) to the modular AWS SDK v3 S3 client (@aws-sdk/client-s3) to reduce dependency footprint and reapply the previously reverted SDK migration.
Changes:
- Update
scripts/upload-assets.jsto useS3Client+PutObjectCommandandclient.send()instead ofs3.putObject().promise() - Replace
aws-sdkwith@aws-sdk/client-s3inpackage.jsondevDependencies - Regenerate
yarn.lockto reflect the new dependency graph with AWS SDK v2 removed
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| scripts/upload-assets.js | Switch S3 upload implementation from AWS SDK v2 to v3 command-based client API. |
| package.json | Swap devDependency from aws-sdk to @aws-sdk/client-s3. |
| yarn.lock | Update lockfile to remove aws-sdk v2 and add AWS SDK v3 transitive dependencies. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
staging has run this exact version for a while, so align master to it instead of jumping to latest. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.
| .promise(); | ||
| await s3.send(new PutObjectCommand({ // upload "latest" manifest file | ||
| Bucket: bucket, | ||
| Key: key('/manifest-latest.json'), |
|
|
||
| await s3.send(new PutObjectCommand({ // upload hash manifest file | ||
| Bucket: bucket, | ||
| Key: key(`/manifest-${sha}.json`), |
| "@babel/core": "^7.12.10", | ||
| "@babel/preset-env": "^7.12.11", | ||
| "aws-sdk": "^2.760.0", | ||
| "@aws-sdk/client-s3": "3.988.0", |
| "@babel/core": "^7.12.10", | ||
| "@babel/preset-env": "^7.12.11", | ||
| "aws-sdk": "^2.760.0", | ||
| "@aws-sdk/client-s3": "3.988.0", |
mdkhan-tw
left a comment
There was a problem hiding this comment.
Could you please add why we are making the change?
Could you add some testing artefact here?
Summary
scripts/upload-assets.jsfrom the monolithicaws-sdkv2 to the modular@aws-sdk/client-s3v3 packageWhy the revert happened
#844 bundled the SDK migration together with a Buildkite CI image bump (Node 12 -> Node 20), since
@aws-sdk/client-s3requires a newer Node runtime than the CI image had. That combined change broke themastermerge build on the oldsegment/analytics-dot-js-integrationsBuildkite pipeline, so it was reverted in #847.Since then, this repo's Buildkite pipeline has migrated to Twilio's org (
twilio/cdp-analytics-dot-js-integrations), and.buildkite/pipeline.ymlonmasteralready runs onNODE_BROWSER_IMAGE(Node 22). That removes the original blocker, so this PR only touches the SDK usage itself — no CI pipeline/image changes.Changes
scripts/upload-assets.jsrequire('aws-sdk/clients/s3')withconst { S3Client, PutObjectCommand } = require('@aws-sdk/client-s3')new S3Client({ region, credentials: { ... } })instead ofnew S3({ accessKeyId, secretAccessKey, sessionToken, region })s3.putObject(params).promise()withs3.send(new PutObjectCommand(params))throughout (putObject helper + 2 manifest uploads)package.json"aws-sdk": "^2.760.0"with"@aws-sdk/client-s3": "^3.1098.0"in devDependenciesyarn.lockyarn install; no leftoveraws-sdkv2 entriesTest plan
node -c scripts/upload-assets.js— syntax check passesS3Client,PutObjectCommand, andclient.send()verified to instantiate/work at runtime on Node 22aws-sdk@v2 entry remains inyarn.lock🤖 Generated with Claude Code