Cannot connect to a Scratch Org

Issue #2549 resolved
Ioan Iosif Predescu created an issue

Hello,

It is impossible for me to connect to a new Scratch Org. I authorise the org, but nothing happens afterward. The connection doesn’t appear in the list of available connections and cannot be selected when trying to change the connection (bottom right corner of the screen).

I tried also to create it using the access token. The connection appears in the list of connections to open, but not in the list when you try to change it for the project.

Please help me soon, because I have a lot to develop in a shot period of time and using VS code is not very productive.

Thank you very much!

Iosif

Comments (17)

  1. Scott Wells repo owner
    • changed status to open

    Hi. Can you please make sure that you're on the latest builds of both the JetBrains IDE and IC2, then also please make sure that your Salesforce CLI is in a good state as that can be the root cause of a large number of issues. Please see the latest build's release notes for more information on how to uninstall/reinstall the CLI if at all in doubt:

    https://illuminatedcloud.blogspot.com/2024/04/2306-release-notes.html

    If the issue is still happening at that point, please enable debug logging for Salesforce DX, reproduce the behavior, and send me the resulting idea.log file for review.

  2. Ioan Iosif Predescu reporter
      <div class="preview-container wiki-content"><!-- loaded via ajax --></div>
      <div class="mask"></div>
    </div>
    

    </div> </form>

  3. Ioan Iosif Predescu reporter

    Hi Scott,

    Still the same.. Here it is the log file. Hope is correct. Let me know pls if you need something more.

    Thank you a lot,

    Iosif

  4. Scott Wells repo owner

    Hi. Can you please remove the debug logging entry for ForceIgnoreUtil, reproduce again, and send over another idea.log for review?

  5. Ioan Iosif Predescu reporter
      <div class="preview-container wiki-content"><!-- loaded via ajax --></div>
      <div class="mask"></div>
    </div>
    

    </div> </form>

  6. Scott Wells repo owner

    Hi. It does not look like you’ve updated IC2 to the latest version as I see the following in the log:

    Running command line: '/usr/local/lib/sf/bin/sf force:org:list --json'
    

    but, based on today’s update, that CLI execution would now be:

    sf org list --json
    

    Please see my first response in this issue regarding making sure that all software is 100% up-to-date and, if the same issue is still present, please send an updated log for review.

  7. Ioan Iosif Predescu reporter
      <div class="preview-container wiki-content"><!-- loaded via ajax --></div>
      <div class="mask"></div>
    </div>
    

    </div> </form>

  8. Ioan Iosif Predescu reporter

    The thing is I have this problem from some months ago, but now I cannot work-around it (if I create the SO from my machine, the connection remains there)

  9. Scott Wells repo owner

    Okay. That one helps. I can see where you’re logging into a scratch org using sf org login web with username ioan.predescu@nn-group.com and alias Que_SO_2. That login succeeds:

    2024-04-11 20:24:58,667 [ 513313]   FINE - #com.illuminatedcloud.intellij.util.CommandLineUtil - Running command line: '/usr/local/lib/sf/bin/sf org login web -a Que_SO_2 -r https://test.salesforce.com/ --json' from working directory: '/Users/iosif/Documents/Projects/Salesforce'.
    2024-04-11 20:25:20,744 [ 535390]   FINE - #com.illuminatedcloud.intellij.util.CommandLineUtil - Returning command-line response: CommandLineResponse{exitCode=0, output='{
      "status": 0,
      "result": {
        "accessToken": "00D7Z0000005kH5!AQYAQARcRcbzioJfeczVQFIOPnGNfqwQcOeavwZKltr0kYbkNcCniL9NuYMAUUlIRg_TCcckE9zu37equH5.OlxcVeOvIEE.",
        "instanceUrl": "https://wonton-scala-51.scratch.my.salesforce.com",
        "orgId": "00D7Z0000005kH5UAI",
        "username": "ioan.predescu@nn-group.com",
        "loginUrl": "https://test.salesforce.com/",
        "refreshToken": "5Aep861r5PsxMS0.UrNB75t_QdhxUxMN46xmeinGdov9EBjeikwNU6lxELwN9VLD2iiQAAdSzoNxszYOIW888SM",
        "clientId": "PlatformCLI",
        "isDevHub": false,
        "instanceApiVersion": "60.0",
        "instanceApiVersionLastRetrieved": "4/11/2024, 3:22:12 PM",
        "name": "Org_Reuse",
        "instanceName": "CS108",
        "namespacePrefix": null,
        "isSandbox": false,
        "isScratch": true,
        "trailExpirationDate": "2023-12-08T11:17:49.000+0000",
        "tracksSource": true,
        "devHubUsername": "ioan.predescu@nn-group.com.devhub",
        "expirationDate": "2024-05-10"
      },
      "warnings": []
    }
    ', error='', duration=22076}
    

    However, when IC2 runs sf org list immediately after that successful login, the response does not include that org in the list even by org ID. You can probably confirm this behavior locally in complete isolation of IC2 by running the following directly from the command-line:

    sf org logout -o ioan.predescu@nn-group.com -p
    sf org login web -a Que_SO_2 -r https://test.salesforce.com/
    sf org list
    

    I’m guessing that the last command, sf org list, will not include the newly-authenticated scratch org connection. At least that’s exactly what I’m seeing in the IC2 log that you’ve provided. If that’s in fact the case, your best bet would be to log a bug in the Salesforce CLI public issue tracker with those exact steps and their output showing that after successfully authenticating to an org, you’re not seeing it included in the org list command output.

    If you’re unable to reproduce this from the command-line, please provide the output of the commands listed above so that I can see what might be different between how they’re executed from IC2 and how they’re executed from the command-line.

  10. Ioan Iosif Predescu reporter

    I executed those commands in isolation and I still cannot see in the list the new connection, but I see it in VS Code. Could it be an issue of IntelliJ?

  11. Scott Wells repo owner

    I honestly don’t know how VS Code is getting the org list, but it should be doing so only via the output of org list and not “cheating” by looking at the raw files directly. The fact that it’s not showing up in org list after a successful org login web is clearly a bug in the CLI and is the root cause of the issue you’re seeing in IC2. All tooling – including Salesforce’s – is supposed to be using the CLI-as-an-API approach to getting and managing this information. I’d recommend logging a bug in the CLI public issue tracker based only on the CLI reproduction and see what they say.

  12. Ioan Iosif Predescu reporter

    Ok, I will do it like this. I think that this issue could be closed, since it’s not related to Illuminated Cloud. Thanks a lot!

    Iosif

  13. Scott Wells repo owner

    Seems to be a CLI issue. Certainly feel free to reopen if it does turn out it's (somehow?) IC2-specific. I'd also be interested to hear the outcome of whatever bug you file with the CLI folks if you don't mind.

  14. Log in to comment