Skip to content

Commit 6958c25

Browse files
fix: update Auth LSP before anything else
The Auth LSP complains if we set the developer profile before setting the bearer token, because it assumes we should not be setting a profile if a token does not exist. So to fix this, we first ensure the server is updated with the token. Signed-off-by: nkomonen-amazon <[email protected]>
1 parent 33a5736 commit 6958c25

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/core/src/codewhisperer/util/authUtil.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,18 +257,20 @@ export class AuthUtil implements IAuthProvider {
257257

258258
private async refreshState(state = this.getAuthState()) {
259259
if (state === 'expired' || state === 'notConnected') {
260+
this.lspAuth.deleteBearerToken()
261+
260262
if (this.isIdcConnection()) {
261263
await this.regionProfileManager.invalidateProfile(this.regionProfileManager.activeRegionProfile?.arn)
262264
await this.regionProfileManager.clearCache()
263265
}
264-
this.lspAuth.deleteBearerToken()
265266
}
266267
if (state === 'connected') {
268+
const bearerTokenParams = (await this.session.getToken()).updateCredentialsParams
269+
await this.lspAuth.updateBearerToken(bearerTokenParams)
270+
267271
if (this.isIdcConnection()) {
268272
await this.regionProfileManager.restoreProfileSelection()
269273
}
270-
const bearerTokenParams = (await this.session.getToken()).updateCredentialsParams
271-
await this.lspAuth.updateBearerToken(bearerTokenParams)
272274
}
273275

274276
vsCodeState.isFreeTierLimitReached = false

0 commit comments

Comments
 (0)