Skip to content

Commit 0c44f1e

Browse files
authored
Merge pull request #5418 from hayemaxi/loglevels
Misc small changes (allow trailing slash in start url, updating log level)
2 parents 9db64b1 + 717062f commit 0c44f1e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/core/src/login/webview/vue/login.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ type Stage = 'START' | 'SSO_FORM' | 'CONNECTED' | 'AUTHENTICATING' | 'AWS_PROFIL
286286
287287
function validateSsoUrlFormat(url: string) {
288288
const regex =
289-
/^(https?:\/\/(.+)\.awsapps\.com\/start|https?:\/\/identitycenter\.amazonaws\.com\/ssoins-[\da-zA-Z]{16})$/
289+
/^(https?:\/\/(.+)\.awsapps\.com\/start|https?:\/\/identitycenter\.amazonaws\.com\/ssoins-[\da-zA-Z]{16})\/?$/
290290
return regex.test(url)
291291
}
292292
@@ -484,7 +484,7 @@ export default defineComponent({
484484
if (this.startUrl && !validateSsoUrlFormat(this.startUrl)) {
485485
this.startUrlError =
486486
'URLs must start with http:// or https://. Example: https://d-xxxxxxxxxx.awsapps.com/start'
487-
} else if (this.startUrl && this.existingStartUrls.some(url => url === this.startUrl)) {
487+
} else if (this.startUrl && this.existingStartUrls.some((url) => url === this.startUrl)) {
488488
this.startUrlError =
489489
'A connection for this start URL already exists. Sign out before creating a new one.'
490490
} else {
@@ -520,7 +520,7 @@ export default defineComponent({
520520
// to reuse connections in AWS Toolkit & Amazon Q
521521
const sharedConnections = await client.fetchConnections()
522522
sharedConnections
523-
?.filter(c => !this.existingStartUrls.includes(c.startUrl))
523+
?.filter((c) => !this.existingStartUrls.includes(c.startUrl))
524524
.forEach((connection, index) => {
525525
this.importedLogins.push({
526526
id: LoginOption.IMPORTED_LOGINS + index,
@@ -535,7 +535,7 @@ export default defineComponent({
535535
this.$forceUpdate()
536536
},
537537
async updateExistingStartUrls() {
538-
this.existingStartUrls = (await client.listSsoConnections()).map(conn => conn.startUrl)
538+
this.existingStartUrls = (await client.listSsoConnections()).map((conn) => conn.startUrl)
539539
},
540540
async getDefaultStartUrl() {
541541
return await client.getDefaultStartUrl()

packages/core/src/shared/clients/ec2MetadataClient.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ export class DefaultEc2MetadataClient {
4040
;(this.metadata as any).fetchMetadataToken((tokenErr: AWSError, token: string) => {
4141
let options
4242
if (tokenErr) {
43-
getLogger().error('Ec2MetadataClient failed to fetch token: %s', tokenErr)
43+
getLogger().warn(
44+
'Ec2MetadataClient failed to fetch token. If this is an EC2 environment, then Toolkit will fall back to IMDSv1: %s',
45+
tokenErr
46+
)
4447

4548
// Fall back to IMDSv1 for legacy instances.
4649
options = {}

0 commit comments

Comments
 (0)