Commit 0abd582
authored
fix(auth): prevent connection usage when console login is cancelled or fails (#8580)
## Problem
- #8537 introduced
setupConsoleConnection() and getFunctionWithFallback() to handle
authentication fallback for Lambda console-to-IDE transitions.
- When developers click "Open in VSCode" and their local AWS profile is
invalid, toolkit automatically triggers browser-based console login as a
fallback. However, console login requires prerequisites that not all
developers can complete. When developers cancel console login, the CLI
never writes the connection profile to disk. The Toolkit then attempts
to use this non-existent connection, resulting in "Connection does not
exist" errors.
<img width="471" height="265"
alt="problem-before-the-fix-connection-does-not-exist"
src="https://github.com/user-attachments/assets/fd973ce1-7b28-4474-8b55-b0408c67e0ce"
/>
## Solution
- Verify connection exists in `setupConsoleConnection()` after
"aws.toolkit.auth.consoleLogin" completes
- Show warning message with link to [prerequisites
documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sign-in.html#cli-configure-sign-in-prerequisites)
when connection verification fails
- Throw ToolkitError to halt execution and prevent downstream connection
usage
<img width="1293" height="302" alt="update-message-with-learnmore"
src="https://github.com/user-attachments/assets/a1d35f14-4c42-43c1-8417-b6532ed00e9a"
/>
<img width="1042" height="625" alt="click-learnmore-show-dialog"
src="https://github.com/user-attachments/assets/aace3330-4ea8-4bd8-ad24-e8e956f09c45"
/>
### Background
The Lambda load-function URI handler enables a seamless workflow where
users can click "Open in Visual Studio Code" from the AWS Lambda console
to view, edit, and deploy their Lambda functions directly in their
preferred IDE. This feature downloads the function code locally, opens
it in VS Code, and allows users to make changes and deploy updates back
to AWS—all without leaving their development environment.
---
- 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.1 parent 91120f2 commit 0abd582
File tree
4 files changed
+45
-1
lines changed- packages
- core/src
- auth
- test/auth
- toolkit/.changes/next-release
4 files changed
+45
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
926 | 927 | | |
927 | 928 | | |
928 | 929 | | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
929 | 944 | | |
930 | 945 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
42 | 46 | | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
46 | 69 | | |
47 | 70 | | |
| 71 | + | |
48 | 72 | | |
49 | 73 | | |
50 | 74 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments