Skip to content

Commit f0b709b

Browse files
test authutil error
Signed-off-by: nkomonen-amazon <[email protected]>
1 parent 2c01b0d commit f0b709b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/core/src/test/setupUtil.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,15 @@ export function registerAuthHook(secret: string, lambdaId = process.env['AUTH_UT
224224
const openStub = patchObject(vscode.env, 'openExternal', async (target) => {
225225
try {
226226
const url = new URL(target.toString(true))
227-
const userCode = url.searchParams.get('user_code')
228227

229-
// TODO: Update this to just be the full URL if the authorizer lambda ever
230-
// supports the verification URI with user code embedded (VerificationUriComplete).
231-
const verificationUri = url.origin
228+
// A `#` was added in to the URL path and broke the parsing, so we need to drop the '#'
229+
// Eg: 'https://nkomonen.awsapps.com/start/#/device?user_code=JXZC-NVRK'
230+
const urlWithoutHash = target.toString(true).replace(/\/\#/, '')
231+
const userCode = new URL(urlWithoutHash).searchParams.get('user_code')
232+
233+
// Drop the user_code parameter since the auth lambda does not support it yet.
234+
// TODO: If the auth lambda supports user_code in the parameters then we can skip this step
235+
const verificationUri = url.origin + url.pathname
232236

233237
await invokeLambda(lambdaId, {
234238
secret,

0 commit comments

Comments
 (0)