-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix(@aws-amplify/storage): Automatically adjust systemClockoffset in Storage #9115
Conversation
This pull request introduces 2 alerts when merging 580ee21 into 5d5083c - view on LGTM.com new alerts:
|
Codecov Report
@@ Coverage Diff @@
## main #9115 +/- ##
==========================================
+ Coverage 78.01% 78.07% +0.05%
==========================================
Files 250 250
Lines 18116 18122 +6
Branches 3889 3891 +2
==========================================
+ Hits 14133 14148 +15
+ Misses 3853 3844 -9
Partials 130 130
Continue to review full report at Codecov.
|
This pull request introduces 1 alert when merging 03faab9 into 2b800f5 - view on LGTM.com new alerts:
|
Closing this as we as a team decided to upgrade the |
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.
LGTM 🌮
if (isTimeSkewedError(err)) { | ||
const serverDate = new Date(err.ServerTime); | ||
config.systemClockOffset = serverDate.getTime() - Date.now(); | ||
} | ||
throw err; | ||
} |
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.
Wrote this part based on https://github.com/aws/aws-sdk-js-v3/blob/main/packages/middleware-signing/src/middleware.ts#L32-L35
Upgrading aws-sdk might actually take us longer and requires more discussion with the team. We are re-opening this PR as a temporary workaround to unblock any users with clock skew issues with 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.
Just one qustions
Overall LGTM
Thanks @jamesaucode 🌮
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.
LGTM thanks @jamesaucode 🌮 🏅
This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Description of changes
AxiosHttpHandler
, we should return anHttpResponse
with the related info caught from the error, else all the s3middleware including error serializing and retry middleware will fail if any error is caught.autoAdjustClockskewMiddleware
that will automatically adjust the client option'ssystemClockoffset
if aRequestTimeTooSkewed
error is encountered.createNewS3Client
is re-used in multiple files, extracted it's logic toS3ClientUtils.ts
AWSManagedUpload
so that it doesn't createS3Client
for every single part. Instead it uses 1 mains3client
inside the class.AxiosHttpHandler
to take call-specificEventsEmitter
, this allows multipart upload to pass event emitter that belongs to an individual part.Edit: Newer
aws-sdk
introduced some changes that will be breaking for our React Native customers. Therefore we are adding this middleware as a temporary workaround to unblock customers with clock skew issues.Issue #, if available
fixes #6494
Description of how you validated changes
Unit tests
Manually tested by adjusting the system clock and doing Storage api calls
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.