Skip to content

Commit

Permalink
ARTESCA-9954: Fix the RoleArn is invalid issue in console
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengYanJin committed Oct 24, 2023
1 parent 479ce3e commit 0f69c3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/js/STSClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export default class STSClient {
}) {
const { idToken, roleArn, RoleSessionName } = params;
const p = {
DurationSeconds: 900,
// 15 minutes
DurationSeconds: 900, // 15 minutes
RoleArn: roleArn,
RoleSessionName,
WebIdentityToken: idToken,
Expand Down
8 changes: 6 additions & 2 deletions src/react/DataServiceRoleProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,19 @@ const DataServiceRoleProvider = ({ children }: { children: JSX.Element }) => {
} else if (!storedRole && !role.roleArn && accounts.length) {
setRoleState({ roleArn: accounts[0].Roles[0].Arn });
}
assumeRoleMutation.mutate(role.roleArn);
if (role.roleArn) {
assumeRoleMutation.mutate(role.roleArn);
}
}, [role.roleArn, JSON.stringify(accounts)]);

const { getS3Config } = useS3ConfigFromAssumeRoleResult();

const setRole = (role: { roleArn: string }) => {
setRoleArnStored(role.roleArn);
setRoleState(role);
assumeRoleMutation.mutate(role.roleArn);
if (role.roleArn) {
assumeRoleMutation.mutate(role.roleArn);
}
};

if (role.roleArn && !assumeRoleMutation.data) {
Expand Down

0 comments on commit 0f69c3f

Please sign in to comment.