Skip to content

Commit 82d4c51

Browse files
authored
fix(codewhisperer): credentials refresh skipped on Cloud9 #3367
Problem: We can't tell if the default connection is expired or not on C9 until after making an API call. So the reauthenticate logic in authUtil.ts does not work on Cloud9. Solution: Remove the check to always force a refresh.
1 parent 2eead05 commit 82d4c51

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "CodeWhisperer shows \"The security token included in this request is expired\" in Cloud9"
4+
}

scripts/newChange.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as child_process from 'child_process'
77
import * as fs from 'fs-extra'
88
import { join } from 'path'
99
import * as readlineSync from 'readline-sync'
10+
import * as crypto from 'crypto'
1011

1112
const directory = join(process.cwd(), '.changes', 'next-release')
1213
const changeTypes = ['Breaking Change', 'Feature', 'Bug Fix', 'Deprecation', 'Removal', 'Test']

src/codewhisperer/util/authUtil.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,10 @@ export class AuthUtil {
187187
}
188188

189189
public async reauthenticate() {
190-
if (this.isConnectionExpired()) {
191-
try {
192-
await this.auth.reauthenticate(this.conn!)
193-
} catch (err) {
194-
throw ToolkitError.chain(err, 'Unable to authenticate connection')
195-
}
190+
try {
191+
await this.auth.reauthenticate(this.conn!)
192+
} catch (err) {
193+
throw ToolkitError.chain(err, 'Unable to authenticate connection')
196194
}
197195
}
198196

0 commit comments

Comments
 (0)