From 77db9cc0cedef31da5b8f5487ad3d89c89b191da Mon Sep 17 00:00:00 2001 From: nkomonen-amazon Date: Fri, 10 Jan 2025 10:32:45 -0500 Subject: [PATCH 1/2] test authutil error Signed-off-by: nkomonen-amazon --- packages/core/src/test/setupUtil.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/core/src/test/setupUtil.ts b/packages/core/src/test/setupUtil.ts index f158d67ad55..0544304d25b 100644 --- a/packages/core/src/test/setupUtil.ts +++ b/packages/core/src/test/setupUtil.ts @@ -224,7 +224,11 @@ export function registerAuthHook(secret: string, lambdaId = process.env['AUTH_UT const openStub = patchObject(vscode.env, 'openExternal', async (target) => { try { const url = new URL(target.toString(true)) - const userCode = url.searchParams.get('user_code') + + // A `#` was added in to the URL path and broke the parsing, so we need to drop the '#' + // Eg: 'https://nkomonen.awsapps.com/start/#/device?user_code=JXZC-NVRK' + const urlWithoutHash = target.toString(true).replace(/\/\#/, '') + const userCode = new URL(urlWithoutHash).searchParams.get('user_code') // TODO: Update this to just be the full URL if the authorizer lambda ever // supports the verification URI with user code embedded (VerificationUriComplete). From 15543d87b6062f0e78f866fd64b1e94cc4462ada Mon Sep 17 00:00:00 2001 From: nkomonen-amazon Date: Mon, 13 Jan 2025 13:17:10 -0500 Subject: [PATCH 2/2] test Signed-off-by: nkomonen-amazon --- packages/core/src/test/setupUtil.ts | 33 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/packages/core/src/test/setupUtil.ts b/packages/core/src/test/setupUtil.ts index 0544304d25b..eebeaca2f95 100644 --- a/packages/core/src/test/setupUtil.ts +++ b/packages/core/src/test/setupUtil.ts @@ -223,22 +223,23 @@ export function registerAuthHook(secret: string, lambdaId = process.env['AUTH_UT const openStub = patchObject(vscode.env, 'openExternal', async (target) => { try { - const url = new URL(target.toString(true)) - - // A `#` was added in to the URL path and broke the parsing, so we need to drop the '#' - // Eg: 'https://nkomonen.awsapps.com/start/#/device?user_code=JXZC-NVRK' - const urlWithoutHash = target.toString(true).replace(/\/\#/, '') - const userCode = new URL(urlWithoutHash).searchParams.get('user_code') - - // TODO: Update this to just be the full URL if the authorizer lambda ever - // supports the verification URI with user code embedded (VerificationUriComplete). - const verificationUri = url.origin - - await invokeLambda(lambdaId, { - secret, - userCode, - verificationUri, - }) + throw new Error(`Auth URL: ${target.toString(true)}`) + // const url = new URL(target.toString(true)) + // + // // A `#` was added in to the URL path and broke the parsing, so we need to drop the '#' + // // Eg: 'https://nkomonen.awsapps.com/start/#/device?user_code=JXZC-NVRK' + // const urlWithoutHash = target.toString(true).replace(/\/\#/, '') + // const userCode = new URL(urlWithoutHash).searchParams.get('user_code') + // + // // TODO: Update this to just be the full URL if the authorizer lambda ever + // // supports the verification URI with user code embedded (VerificationUriComplete). + // const verificationUri = url.origin + // + // await invokeLambda(lambdaId, { + // secret, + // userCode, + // verificationUri, + // }) } finally { openStub.dispose() }