Skip to content

Updating aws sdk to v3#34

Merged
jlouk merged 7 commits into
masterfrom
chore/updating-aws-sdk-v3
Jul 28, 2025
Merged

Updating aws sdk to v3#34
jlouk merged 7 commits into
masterfrom
chore/updating-aws-sdk-v3

Conversation

@jlouk
Copy link
Copy Markdown
Contributor

@jlouk jlouk commented Jul 27, 2025

What Changed?

  • Upgraded all aws sdk v2 calls to aws sdk v3 due to v2 EOL in September

Testing

I have tested and confirmed this works this with each of the bin commands:

  • ./bin/s3scan.js s3://<redacted>/
  • ./bin/s3keys.js s3://redacted/
  • ./bin/s3purge.js s3://redacted/

Since this is a public repo, I have removed the s3 paths and information

Comment thread index.js
@@ -1,4 +1,4 @@
var s3urls = require('@mapbox/s3urls');
var s3urls = require('./lib/s3url-parser');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a deprecated library so I just implemented the necessary functions in s3url-parser

@jlouk jlouk marked this pull request as ready for review July 28, 2025 17:44
@jlouk jlouk requested a review from a team as a code owner July 28, 2025 17:44
Copy link
Copy Markdown

@bilindhajer bilindhajer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments

Comment thread lib/delete.js Outdated

function removed(err) {
if (err && err.statusCode !== 404) return callback(awsError(err, params));
if (err && err.name !== 'NoSuchKey') return callback(awsError(err, params));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like 404 would capture more than just NoSuchKey, can we add NoSuchBucket too?

Comment thread lib/delete.js Outdated

function removed(err) {
if (err && err.name !== 'NoSuchKey') return callback(awsError(err, params));
if (err && err.name !== 'NoSuchKey' && err.name !== 'NoSuchBucket' && err.statusCode !== 404) return callback(awsError(err, params));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And maybe also check if its an S3ServiceError exception?

Comment thread lib/delete.js Outdated
const s3config = {
maxRetries: 10,
httpOptions: { connectTimeout: 3000 }
maxAttempts: 10,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would we want to make this 11 to account for the base attempt? (the maxRetries is 10 above)

Comment thread lib/delete.js

const s3config = {
maxRetries: 10,
httpOptions: { connectTimeout: 3000 }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connectTimeout and requestTimeout would not be the same thing. Please refer to here for example https://github.com/mapbox/aws-logs/blob/main/cdk/lib/forwarders/clients/s3.ts#L39-L43

Comment thread lib/delete.js
requestTimeout: 3000,
requestHandler: new NodeHttpHandler({
httpAgent: new Agent({}),
connectionTimeout: 20 * 1000,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we keep this 3000 like before?

@jlouk jlouk merged commit 63d08ba into master Jul 28, 2025
3 checks passed
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