Skip to content

Display environment context in error messages like Try logging in using 'coder login <url>' #11505

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

Closed
Tracked by #10759
denbeigh2000 opened this issue Jan 9, 2024 · 1 comment · Fixed by #17715
Closed
Tracked by #10759
Labels
good first issue Easily solved issues suitable for starters and community contributors

Comments

@denbeigh2000
Copy link
Contributor

denbeigh2000 commented Jan 9, 2024

Context

The following message is displayed when a user has an invalid/expired session:

You are signed out or your session has expired. Please sign in again to continue.
Try logging in using 'coder login <url>'.

These appear to all be hardcoded

(grep snippet)
$ rg 'coder login <url>'
cli/logout.go
71:			_, _ = fmt.Fprintf(inv.Stdout, Caret+"You are no longer logged in. You can log in using 'coder login <url>'.\n")

cli/logout_test.go
44:		pty.ExpectMatch("You are no longer logged in. You can log in using 'coder login <url>'.")
70:		pty.ExpectMatch("You are no longer logged in. You can log in using 'coder login <url>'.")
95:			assert.ErrorContains(t, err, "You are not logged in. Try logging in using 'coder login <url>'.")
122:			assert.ErrorContains(t, err, "You are not logged in. Try logging in using 'coder login <url>'.")

cli/root.go
68:	notLoggedInMessage  = "You are not logged in. Try logging in using 'coder login <url>'."

cli/userlist_test.go
67:		require.Contains(t, err.Error(), "Try logging in using 'coder login <url>'.")
80:		require.Contains(t, err.Error(), "Try logging in using 'coder login <url>'.")

codersdk/client.go
344:		helpMessage = "Try logging in using 'coder login <url>'."

coderd/templates_test.go
168:		require.Contains(t, err.Error(), "Try logging in using 'coder login <url>'.")

Ask

The Coder CLI should respect the values of $CODER_URL and $CODER_SSH_CONFIG_BINARY_PATH when displaying these messages.

Example of desired behaviour

You are signed out or your session has expired. Please sign in again to continue.
Try logging in using '/home/denbeigh/path/to/coder login https://denbeighs.coder.instance.real'.

Context

When Coder is deployed in an organisational setting, it may be wrapped in a way that pre-sets these values.

Using these values in logged-out error messages would mean users can just copy-paste the command into their terminal, without needing to confirm what the URL is, or if the right command/right version of the command is being run.

@mattlqx
Copy link

mattlqx commented Jan 9, 2024

related: #10925

@sreya sreya self-assigned this Jan 9, 2024
@kylecarbs kylecarbs changed the title Feature Request: More informative help text during expired sessions Display environment context in error messages like Try logging in using 'coder login <url>' May 31, 2024
@matifali matifali removed the feature label Oct 14, 2024
@matifali matifali added the good first issue Easily solved issues suitable for starters and community contributors label Nov 21, 2024
@sreya sreya removed their assignment Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Easily solved issues suitable for starters and community contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants