Skip to content
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(client): correct clock skew from any response #11503

Merged
merged 4 commits into from
Jun 16, 2023

Conversation

AllanZhengYP
Copy link
Contributor

Description of changes

Currently only in Pinpoint client, we use signing middleware to keep track of clock offset between local clock and server clock. The current implementation incorrectly assumes the error responses are already parsed to JavaScript errors and thrown from next handler. However this is not true for signing middleware. Because it's applied always after the retry middleware, the HTTP responses regardless of status code are returned from the next handler.

The signing middleware after this change, maintain the offset for both successful or fail HTTP response.

Description of how you validated changes

Manually validated.

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@AllanZhengYP AllanZhengYP requested review from a team as code owners June 14, 2023 22:36
@codecov-commenter
Copy link

codecov-commenter commented Jun 14, 2023

Codecov Report

Merging #11503 (14ec078) into main (2e1e1f5) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main   #11503      +/-   ##
==========================================
- Coverage   83.24%   83.24%   -0.01%     
==========================================
  Files         274      274              
  Lines       20565    20559       -6     
  Branches     4447     4444       -3     
==========================================
- Hits        17120    17114       -6     
  Misses       3157     3157              
  Partials      288      288              
Impacted Files Coverage Δ
...e/src/clients/middleware/retry/isClockSkewError.ts 100.00% <ø> (ø)
...rc/clients/middleware/retry/defaultRetryDecider.ts 100.00% <100.00%> (ø)
.../core/src/clients/middleware/signing/middleware.ts 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@manueliglesias manueliglesias left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@elorzafe elorzafe left a comment

Choose a reason for hiding this comment

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

Looks good, thanks @AllanZhengYP 🏅

@AllanZhengYP AllanZhengYP merged commit c1fa9c7 into aws-amplify:main Jun 16, 2023
5 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.

None yet

6 participants