Skip to content

Conversation

@jlouk
Copy link
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

@@ -1,4 +1,4 @@
var s3urls = require('@mapbox/s3urls');
var s3urls = require('./lib/s3url-parser');
Copy link
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

@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

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));

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?

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));

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?

lib/delete.js Outdated
const s3config = {
maxRetries: 10,
httpOptions: { connectTimeout: 3000 }
maxAttempts: 10,

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)


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

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

requestTimeout: 3000,
requestHandler: new NodeHttpHandler({
httpAgent: new Agent({}),
connectionTimeout: 20 * 1000,

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