Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: whoami results in an fatal error when the session is expired #3867

Closed
IgorMinar opened this issue Aug 29, 2023 · 0 comments · Fixed by #5030
Closed

🐛 BUG: whoami results in an fatal error when the session is expired #3867

IgorMinar opened this issue Aug 29, 2023 · 0 comments · Fixed by #5030
Assignees
Labels
auth Relating to auth bug Something that isn't working

Comments

@IgorMinar
Copy link
Contributor

Which Cloudflare product(s) does this pertain to?

Wrangler core

What version(s) of the tool(s) are you using?

3.6.0

What version of Node are you using?

18

What operating system are you using?

Mac

Describe the Bug

When the current refresh token is expired and the user invokes wrangler whoami, the command results in an error:

(I only have a c3 version of the error, but the same error appears also when wrangler is invoked directly with an expired token)

Screenshot 2023-08-24 at 18 16 25

It is unsurprising that invoking the command results in an error if the current session is invalid. What is surprising is that we are displaying this error as if it was an internal error or an unexpected crash. Notice the following part:

 If you think this is a bug, please open an issue at:
  https://github.com/cloudflare/workers-sdk/issues/new/choose

This seems to indicate to the user that this error is in some way unexpected, but that's not the case at all.

We know up front that calling whoami can result in three possible outcomes:

  1. success: the user is logged in, we list user info
  2. fail: the user is not logged in, we should simply notify the user and suggest that they use wrangler login to log in
  3. crash: some internal error, in which case we should print any kind of contextual info about the error and suggest that the user files a bug

Note that we have two types of failure modes, one that is expected, and one that is unexpected.

Could we change the output of whoami (and elsewhere if there are other places like this) to make the expected failure mode look distinct (and more helpful, e.g. by suggesting wrangler login) from crashes due to an internal error?

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

@IgorMinar IgorMinar added the bug Something that isn't working label Aug 29, 2023
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Aug 29, 2023
@admah admah added the auth Relating to auth label Sep 8, 2023
@mrbbot mrbbot moved this from Untriaged to Backlog in workers-sdk Jan 22, 2024
@mrbbot mrbbot moved this from Backlog to In Review in workers-sdk Feb 16, 2024
@github-project-automation github-project-automation bot moved this from In Review to Done in workers-sdk Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Relating to auth bug Something that isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants