Skip to content

Commit

Permalink
check if cache is being returned
Browse files Browse the repository at this point in the history
  • Loading branch information
Hweinstock committed Nov 12, 2024
1 parent 2be7f2f commit f2c17b8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 2 additions & 0 deletions packages/core/src/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,8 @@ export class Auth implements AuthService, ConnectionManager {
private async _getCredentials(id: Connection['id'], provider: CredentialsProvider): Promise<Credentials> {
const credentials = await this.getCachedCredentials(provider)
if (credentials !== undefined) {
//eslint-disable-next-line aws-toolkits/no-console-log
console.log('returning cached credentials')
return credentials
} else if ((await provider.canAutoConnect()) === true) {
return this.createCachedCredentials(provider)
Expand Down
6 changes: 0 additions & 6 deletions packages/core/src/shared/credentials/userCredentialsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,10 @@ export class UserCredentialsUtils {
const contents = credentialsContext ? ['', createNewCredentialsFile(credentialsContext)] : []

if (await fs.exists(dest)) {
//eslint-disable-next-line aws-toolkits/no-console-log
console.log('hit case where dest exists')
contents.unshift(await fs.readFileText(dest))
} else {
//eslint-disable-next-line aws-toolkits/no-console-log
console.log('hit case where dest exists')
contents.unshift(header)
}
//eslint-disable-next-line aws-toolkits/no-console-log
console.log('contents=%O', contents)
await fs.writeFile(dest, contents.join('\n'))
}
}
2 changes: 1 addition & 1 deletion packages/core/src/test/credentials/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ describe('Auth', function () {
const newCreds = { ...initialCreds, accessKey: 'y', secretKey: 'y' }
await UserCredentialsUtils.generateCredentialsFile(newCreds)
console.log('file exists after generating=%O', await fs.exists(getCredentialsFilename()))
console.log('file contents = %O', await fs.readFileText(getCredentialsFilename()))

assert.deepStrictEqual(await conn.getCredentials(), {
accessKeyId: newCreds.accessKey,
secretAccessKey: newCreds.secretKey,
Expand Down

0 comments on commit f2c17b8

Please sign in to comment.