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(clients): default region and credential provider #1834

Merged
merged 3 commits into from
Dec 23, 2020

Conversation

AllanZhengYP
Copy link
Contributor

@AllanZhengYP AllanZhengYP commented Dec 23, 2020

This change makes default credential only resolves at signer signing a request. So that it won't resolve at client instantiation. It fixes the issues that the default credentials provider resolves when credentials is not required for given operations, like CognitoIdentity.getId().

Fixes: #1798

Example stack trace for missing credentials in browsers:

Error: Credential is missing
    at SignatureV4.credentialProvider (/home/ec2-user/workspace/aws-sdk-js-v3/clients/client-cognito-identity/runtimeConfig.browser.ts:24:67)
    at SignatureV4.signRequest (/home/ec2-user/workspace/aws-sdk-js-v3/packages/signature-v4/src/SignatureV4.ts:220:36)
    at SignatureV4.sign (/home/ec2-user/workspace/aws-sdk-js-v3/packages/signature-v4/src/SignatureV4.ts:171:19)
    at /home/ec2-user/workspace/aws-sdk-js-v3/packages/middleware-signing/src/middleware.ts:28:31
    at StandardRetryStrategy.retry (/home/ec2-user/workspace/aws-sdk-js-v3/packages/middleware-retry/src/defaultStrategy.ts:125:38)
    at /home/ec2-user/workspace/aws-sdk-js-v3/packages/middleware-logger/src/loggerMiddleware.ts:21:20 {
  '$metadata': { attempts: 1, totalRetryDelay: 0 }
}

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-io
Copy link

codecov-io commented Dec 23, 2020

Codecov Report

Merging #1834 (9a47d48) into master (f2a47e8) will increase coverage by 0.01%.
The diff coverage is 90.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1834      +/-   ##
==========================================
+ Coverage   79.30%   79.31%   +0.01%     
==========================================
  Files         368      368              
  Lines       15132    15140       +8     
  Branches     3222     3226       +4     
==========================================
+ Hits        12001    12009       +8     
  Misses       3131     3131              
Impacted Files Coverage Δ
packages/util-waiter/src/waiter.ts 100.00% <ø> (ø)
...middleware-user-agent/src/user-agent-middleware.ts 93.10% <66.66%> (ø)
packages/invalid-dependency/src/invalidProvider.ts 100.00% <100.00%> (ø)
packages/util-waiter/src/createWaiter.ts 100.00% <100.00%> (+11.76%) ⬆️
packages/util-waiter/src/poller.ts 100.00% <100.00%> (ø)
packages/util-waiter/src/utils/validate.ts 100.00% <100.00%> (ø)
protocol_tests/aws-json/endpoints.ts 81.48% <100.00%> (ø)
lib/storage/src/data-chunk/readable-helper.ts 88.23% <0.00%> (-4.08%) ⬇️
protocol_tests/aws-ec2/endpoints.ts 81.48% <0.00%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca1f0d6...9a47d48. Read the comment docs.

Copy link
Contributor

@alexforsyth alexforsyth 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
Member

@trivikr trivikr left a comment

Choose a reason for hiding this comment

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

Fix verified in browser using aws-sdk-js-tests

@AllanZhengYP AllanZhengYP merged commit bc79ab5 into aws:master Dec 23, 2020
@github-actions
Copy link

github-actions bot commented Jan 8, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Error: Credentialis missing" when CognitoIdentityClient is called in browser/ReactNative without credentials
4 participants