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

sfdx force:org:display throws error when defaultusername is set to an expired org #724

Closed
AllanOricil opened this issue Nov 5, 2020 · 5 comments
Assignees

Comments

@AllanOricil
Copy link

Summary

I ran sfdx force:org:display with a defaultorg that was selected as defaultusername for my vscode project and I got this error that it is not treated.

image

Then I ran sfdx force:org:list to see if the org was still valid, and it wasn't.

image

I concluded that this error happens if you have an expired org selected as your defaultusername when running sfdx force:org:display.

Basically this happened because yesterday I created an SO that I discovered it was expired today when I opened my vscode. When I opeed VSCode this org was still selected as default (defaultusername) on sfdx. So there are two small enhancements we can do, one is to treat the error message on sfdx to show to the user that the org is already expired, and the other is to check if the org status before showing the button on the VSCode Status Bar (the one that shows the local defaultusername), or if the org was expired change the state of the button as shown below by running sfdx force:org:config defaultusername=, because that button is listening to changes on the file .sfdx/sfdx_config.json, so If I change sfdx defaultusername then the button changes too. We could also make sfdx set defaultusername to null automatically when the org becomes expired.

image

Steps To Reproduce:

  1. Create a SO that is expired and it can still be seen on sfdx list command
  2. Set this expired SO as the defaultusername, you can use sfdx config command for that, since the vscode extension does not show expired ones for you.
  3. Run sfdx force:org:display using that defaultusername and you will see the non treated error message.

OBS: This will most likely happen when the user open vscode in the next day and the SO is already expired. The user will only notice it after he run display command or list command.

Expected result

sfdx force:org:display should display an error message saying that the current selected org is expired.

Actual result

sfdx force:org:display is showing a non treated error message when it runs with a expired scratch org set as defaultusername

Additional information

Feel free to attach a screenshot.

SFDX CLI Version(to find the version of the CLI engine run sfdx --version):
image

OS and version: Windows 10

@github-actions
Copy link

github-actions bot commented Nov 5, 2020

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@mshanemc mshanemc assigned mshanemc and unassigned mshanemc Jan 8, 2021
@mshanemc
Copy link
Contributor

mshanemc commented Feb 8, 2021

This should be fixed in the new open-source version. You can try it early, here: #835

@AllanOricil
Copy link
Author

@mshanemc I will try it tomorrow. I have an expired SO that I did not delete that I can use to test it. Thanks again.

@mshanemc
Copy link
Contributor

mshanemc commented Feb 8, 2021 via email

@AllanOricil
Copy link
Author

Now I can see a better error message.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants