force:alias:set
command exits successfully but doesn't do anything when there's another (in this case stale) entry with that alias in .sfdx/alias.json
#1810
Labels
bug
Issue or pull request that identifies or fixes a bug
investigating
We're actively investigating this issue
I'd noticed recently that
force:alias:set
didn't seem to working reliably and decided to troubleshoot it a bit today in an effort to characterize the behavior before logging an issue here. I think I've cornered it now. Here's what I've found...First, I ran the following (output scrubbed for only the relevant subset):
As you can see,
force:alias:set
reported success, but the actual update didn't seem to occur, at least not in terms of how the alias/username associations in the output offorce:org:list
.I looked at
.sfdx/alias.json
and noticed that there was already an entry with aliasnpsp_sf_no_ns
for an expired scratch org, so I thought that perhaps runningforce:org:list --clean
might help clear that stale entry and others. After running that command, I was seeing the same behavior, and I also saw the same stale entries inalias.json
. I then manually removed the entry fornpsp_sf_no_ns
fromalias.json
, re-ranforce:alias:set
, and the alias was properly associated with the new username.So there seem to be two potential issues here, one perhaps benign and one that seems to break
force:alias:set
in certain situations. The former is that I would have expectedforce:org:list --clean
to remove not just the stale org entries but also their corresponding entries inalias.json
. The latter is that when an alias is already set inalias.json
, it seems that it cannot be "moved" to another org's username.Oh, and I haven't confirmed this, but another thought just popped into my mind...perhaps the username for that alias was in fact updated, but the original alias wasn't removed and is still being picked up making the behavior more around which entry was found first in the list?
This all on the following CLI version (probably should have started there):
The text was updated successfully, but these errors were encountered: