Skip to content

Commit

Permalink
Merge branch 'main' into ui-components/main
Browse files Browse the repository at this point in the history
  • Loading branch information
wlee221 committed Aug 25, 2020
2 parents 7f2381f + 794c1da commit 9758705
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ executors:

js-test-executor:
docker:
- image: cypress/base:12
- image: cypress/included:4.12.1
- image: verdaccio/verdaccio
resource_class: large

Expand Down
16 changes: 12 additions & 4 deletions .circleci/retry-yarn-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ done

# initialize counter
n=0
# loop until n >= first param
until [ "$n" -ge $N ]
# loop until n > first param
until [ "$n" -gt $N ]
do
# $1 is the argument passed in, e.g. publish:verdaccio
# if the publish command succeeds, `break` exits the loop
Expand All @@ -34,10 +34,18 @@ do
echo "Resetting git HEAD"
git reset --hard
fi


if [ "$n" -eq $N ];
then
echo "Returning error"
exit 1
fi

# increment counter
n=$((n+1))

# wait 5 seconds
sleep 5
echo "Retry $n of $N"
done
done

8 changes: 4 additions & 4 deletions packages/amazon-cognito-identity-js/src/CognitoUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1979,14 +1979,14 @@ export default class CognitoUser {
this.Session = data.Session;
if (answerChallenge === 'SMS_MFA') {
return callback.mfaRequired(
data.challengeName,
data.challengeParameters
data.ChallengeName,
data.ChallengeParameters
);
}
if (answerChallenge === 'SOFTWARE_TOKEN_MFA') {
return callback.totpRequired(
data.challengeName,
data.challengeParameters
data.ChallengeName,
data.ChallengeParameters
);
}
return undefined;
Expand Down
37 changes: 36 additions & 1 deletion packages/core/src/Credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,42 @@ export class CredentialsClass {
return res;
})
.catch(async e => {
return e;
// If identity id is deleted in the console, we make one attempt to recreate it
// and remove existing id from cache.
if (
e.name === 'ResourceNotFoundException' &&
e.message === `Identity '${identityId}' not found.`
) {
logger.debug('Failed to load guest credentials');
this._storage.removeItem('CognitoIdentityId-' + identityPoolId);

const credentialsProvider: CredentialProvider = async () => {
const { IdentityId } = await cognitoClient.send(
new GetIdCommand({
IdentityPoolId: identityPoolId,
})
);
this._identityId = IdentityId;
const cognitoIdentityParams: FromCognitoIdentityParameters = {
client: cognitoClient,
identityId: IdentityId,
};

const credentialsFromCognitoIdentity = fromCognitoIdentity(
cognitoIdentityParams
);

return credentialsFromCognitoIdentity();
};

credentials = credentialsProvider().catch(async err => {
throw err;
});

return this._loadCredentials(credentials, 'guest', false, null);
} else {
return e;
}
});
}

Expand Down

0 comments on commit 9758705

Please sign in to comment.