File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
packages/middleware-user-agent/src Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -43,12 +43,19 @@ export async function checkFeatures(
43
43
}
44
44
45
45
if ( typeof config . credentials === "function" ) {
46
- const credentials : AttributedAwsCredentialIdentity = await config . credentials ?.( ) ;
47
- if ( credentials . accountId ) {
48
- setFeature ( context , "RESOLVED_ACCOUNT_ID" , "T" ) ;
49
- }
50
- for ( const [ key , value ] of Object . entries ( credentials . $source ?? { } ) ) {
51
- setFeature ( context , key as keyof AwsSdkCredentialsFeatures , value ) ;
46
+ try {
47
+ const credentials : AttributedAwsCredentialIdentity = await config . credentials ?.( ) ;
48
+ if ( credentials . accountId ) {
49
+ setFeature ( context , "RESOLVED_ACCOUNT_ID" , "T" ) ;
50
+ }
51
+ for ( const [ key , value ] of Object . entries ( credentials . $source ?? { } ) ) {
52
+ setFeature ( context , key as keyof AwsSdkCredentialsFeatures , value ) ;
53
+ }
54
+ } catch ( e : unknown ) {
55
+ // Sometimes config.credentials is a function but only throws
56
+ // as a way of informing users that something is missing.
57
+ // That error and any other credential retrieval errors are
58
+ // not relevant for feature-checking and should be ignored.
52
59
}
53
60
}
54
61
}
You can’t perform that action at this time.
0 commit comments