Connection to existing org not valid for project

Issue #2348 resolved
Jake Cuevas created an issue

For reference, this had been working previously but in the last 2 weeks it has shifted.

Im using Intellij and Illuminated Cloud 2.

I clone my repository from github and generate my scratch org in my terminal with the Salesforce CLI. I then take my login credentials and add them to Intellij. I load my project and usually I would be able to add the connection to the project and load the offline table. However, the connection isnt shown to be selected.

Comments (11)

  1. Scott Wells repo owner

    That’s the same thing you’d provide to the sfdx force:auth:web:login command for the -a/--alias flag. It will end up being the IC2 connection name. It should be alphanumeric with no spaces, though simple punctuation like - and _ is allowed.

  2. Jake Cuevas reporter

    I was able to start the Oauth connection process with the alias and authenticate on the browser but the new connection is not appearing on my list of connections. I followed the steps in the document but a new connection is not listed. I tried refreshing connections and restarting the IDE but nothing appeared either.

  3. Scott Wells repo owner

    Can you please confirm that your Salesforce CLI is 100% up-to-date? That’s the most common cause of such issues. If you’ve confirmed that it is and this issue is still occuring, please enable debug logging for Salesforce DX, reproduce the issue, and either attach or email the resulting idea.log file for review.

  4. Scott Wells repo owner

    Thanks, Jake. I replied directly with more details, but it appears to be an issue with the Salesforce CLI as immediately after a successful force:auth:web:login execution, a subsequent execution of force:org:list yields an empty list of orgs which is obviously incorrect. I recommend a full uninstall/reinstall of the CLI, making sure to remove cache directories, etc., as documented at:

    https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_uninstall.htm

    and then if the problem persists, logging a bug in the CLI public issue tracker:

    https://github.com/forcedotcom/cli/issues

  5. Jake Cuevas reporter

    Uninstalling and reinstalling CLI did the trick! I was able to connect to my new org.

    My last question is did this setup change recently? I used to only have to add the connection with the username and password as recently as a month ago. Now I have to use the DX connections.

  6. Scott Wells repo owner

    Not surprising that a CLI uninstall/reinstall fixed it. There has been extensive refactoring by Salesforce in the CLI, and I’ve found that quite a few upgrade-in-place installs of it have had issues that are resolved by a scorched earth reinstall.

    As for whether the IC2 behavior has changed, no, it’s been that way for quite a long time. There have been some improvements to ensure that users are told more explicitly about invalid connection/project type combinations, but even those have been in place for perhaps a year or so. Did you happen to change this project from metadata format to source format recently, even just adding an sfdx-project.json file to it? That would explain the difference in behavior.

  7. Log in to comment