Skip to content

Commit 39473b7

Browse files
fix(e2e): failing Auth Lambda (#6334)
## Problem The CC tests are failing in the auth lambda step, saying that the `user_code` value is not a string ## Solution See code for solution NOTE: This part is now fixed, but the auth lambda itself has its own separate issue that needs to first be fixed --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: nkomonen-amazon <[email protected]>
1 parent 9b0590c commit 39473b7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/core/src/test/setupUtil.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,16 @@ export function registerAuthHook(secret: string, lambdaId = process.env['AUTH_UT
223223

224224
const openStub = patchObject(vscode.env, 'openExternal', async (target) => {
225225
try {
226-
const url = new URL(target.toString(true))
227-
const userCode = url.searchParams.get('user_code')
226+
// Latest eg: 'https://nkomonen.awsapps.com/start/#/device?user_code=JXZC-NVRK'
227+
const urlString = target.toString(true)
228228

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
229+
// Drop the user_code parameter since the auth lambda does not support it yet, and keeping it
230+
// would trigger a slightly different UI flow which breaks the automation.
231+
// TODO: If the auth lambda supports user_code in the parameters then we can skip this step
232+
const verificationUri = urlString.split('?')[0]
233+
234+
const params = urlString.split('?')[1]
235+
const userCode = new URLSearchParams(params).get('user_code')
232236

233237
await invokeLambda(lambdaId, {
234238
secret,

0 commit comments

Comments
 (0)