-
Notifications
You must be signed in to change notification settings - Fork 48
Updating aws sdk to v3 #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
bilindhajer
left a comment
There was a problem hiding this 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'); | |||
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this 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
What Changed?
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)
From there I can query and validate it exists in eu-west-1

Then, the coredb replicator runs and puts that record in us-west-2. I perform the same query in us-west-2 and observe:

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:

From there we can query to see if this has been replicated in us-west-2:

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