Skip to content

Commit 42f8826

Browse files
Merge public/master to private/staging
2 parents 3008405 + 90f5459 commit 42f8826

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

packages/core/src/auth/activation.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,28 @@ import { LoginManager } from './deprecated/loginManager'
99
import { fromString } from './providers/credentials'
1010
import { initializeCredentialsProviderManager } from './utils'
1111
import { isAmazonQ, isSageMaker } from '../shared/extensionUtilities'
12+
import { getLogger } from '../shared/logger/logger'
13+
import { getErrorMsg } from '../shared/errors'
1214

1315
interface SagemakerCookie {
1416
authMode?: 'Sso' | 'Iam'
1517
}
1618

1719
export async function initialize(loginManager: LoginManager): Promise<void> {
1820
if (isAmazonQ() && isSageMaker()) {
19-
// The command `sagemaker.parseCookies` is registered in VS Code Sagemaker environment.
20-
const result = (await vscode.commands.executeCommand('sagemaker.parseCookies')) as SagemakerCookie
21-
if (result.authMode !== 'Sso') {
22-
initializeCredentialsProviderManager()
21+
try {
22+
// The command `sagemaker.parseCookies` is registered in VS Code Sagemaker environment.
23+
const result = (await vscode.commands.executeCommand('sagemaker.parseCookies')) as SagemakerCookie
24+
if (result.authMode !== 'Sso') {
25+
initializeCredentialsProviderManager()
26+
}
27+
} catch (e) {
28+
const errMsg = getErrorMsg(e as Error)
29+
if (errMsg?.includes("command 'sagemaker.parseCookies' not found")) {
30+
getLogger().warn(`Failed to execute command "sagemaker.parseCookies": ${e}`)
31+
} else {
32+
throw e
33+
}
2334
}
2435
}
2536
Auth.instance.onDidChangeActiveConnection(async (conn) => {

0 commit comments

Comments
 (0)