Skip to content

Conversation

@jlouk
Copy link

@jlouk jlouk commented Jul 21, 2025

What Changed?

  • Moved all aws-sdk v2 functions to aws-sdk v3

Testing

Current Setup

In coredb-staging you can place an item.
I'll place a test item here in eu-west-1 (primary db table)
Screenshot 2025-07-21 at 2 16 01 PM

From there I can query and validate it exists in eu-west-1
Screenshot 2025-07-21 at 2 20 46 PM

Then, the coredb replicator runs and puts that record in us-west-2. I perform the same query in us-west-2 and observe:
Screenshot 2025-07-21 at 2 33 00 PM

So this works as a replicator, since global tables is not on.

Testing with new changes

In this PR https://github.com/mapbox/coredb-replicator/pull/77 I upgrade the dynamodb replicator to use its beta state. This has been deployed to staging. Let's walk through the same workflow to make sure coredb-staging can handle the testing.

Create a new entry in eu-west-1:
Screenshot 2025-07-21 at 2 44 04 PM

From there we can query to see if this has been replicated in us-west-2:
Screenshot 2025-07-21 at 2 44 39 PM

As you can see, this was replicated without any issue. The lambda sustained no errors in the process. This package is working as expected.

@jlouk jlouk marked this pull request as ready for review July 21, 2025 18:50
@jlouk jlouk requested a review from a team as a code owner July 21, 2025 18:50
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.

This repo is callback hell 😅 . I left some questions

@@ -1,11 +1,12 @@
var AWS = require('aws-sdk');
var { S3Client } = require('@aws-sdk/client-s3');
var { Upload } = require('@aws-sdk/lib-storage');

Choose a reason for hiding this comment

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

I know you didnt introduce this pattern but we should be using const and not var for this


upload.on('httpUploadProgress', function(progress) {
log('[segment %s] Uploaded %s bytes', index, progress.loaded);
size = progress.total;

Choose a reason for hiding this comment

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

intresting it seems progress.loaded was available before this change, assuming total is not deprecated. Do you know the difference between the two?

Copy link
Author

Choose a reason for hiding this comment

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

In @aws-sdk/lib-storage's Upload class the httpUploadProgress event provides a progress object, but progress.total can be undefined or not reliably set.

I'm not married to this change but when testing I noticed the console spitting out 'undefined' for this value. I went down a deep rabbit hole and found this gh issue which recommended using the loaded over total

});
cwClient.send(new PutMetricDataCommand(params))
.then(() => {
// Success

Choose a reason for hiding this comment

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

should we put anything here?

console.log('--------------------------------');
}
});
s3Client.send(new GetObjectCommand(s3url))

Choose a reason for hiding this comment

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

way too many callbacks being used here not related to your PR but it makes everything harder to read, maybe we can come back and use the await/async model

},
"homepage": "https://github.com/mapbox/dynamodb-replicator",
"dependencies": {
"@aws-sdk/client-cloudwatch": "^3.445.0",

Choose a reason for hiding this comment

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

When you do npm ls aws-sdk do you still see it anywhere? Not saying that if you did it would block this PR but I don't think we are done until we remove it at all levels

bilindhajer
bilindhajer previously approved these changes Jul 22, 2025
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.

My suggestions are not blocking but I do think this repo needs a big refactor/modernization

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