Whole IDE is stuck, waiting for the Access Token

Issue #2623 open
Stanislaw Zan created an issue

Would it be possible to make more SFDX checks regarding Access Token, retrieving Log Data etc. to happen in the background?

I’m currently working over quite rigorous corporate VPN, and every time I turn on IDE, open Debug Logs panel, or just Access Token expire during the day, I have to wait long time until the connection is established again. It even can take 3-5 minutes, and during that time when the pop-up from screenshot is present, I cannot use WebStorm at all - I’d like to open files and start coding, but I have to wait, with my gaze long into the unusable IDE, being gazed by the progress bar as well :(

I know some things can happen in the background like metadata-refresh, retrieval and deployment, and that’s awesome. Would it be possible to expand this feature to other checks?

Comments (3)

  1. Scott Wells repo owner
    • changed status to open

    Hi. It's probably not something that can happen quickly, to be honest. I'm curious, though, as to why refreshing an access token is taking 3-5 minutes. That makes it sounds like something is wrong with the VPN altogether as that should be a very quick operation. Can you please enable debug logging for Salesforce DX, reproduce the behavior, and provide an excerpt from idea.log showing IC2 invoking the CLI command sf force org display to refresh the access token? I'd like to see if it's truly that command taking minutes or something else.

  2. Scott Wells repo owner

    Thank you. The issue is actually specifically with the Salesforce CLI. Here’s an excerpt from your provided log showing that to be the case:

    2024-08-23 09:11:34,104 [  41551]   FINE - #com.illuminatedcloud.intellij.util.CommandLineUtil - Running command line: 'C:/Program Files/sf/bin/sf.cmd org display -o stanislaw.zan@CompanyName.com.scpoc2 --json' from working directory: 'C:\Users\aaaaaaaaaaaa'.
    ...
    2024-08-23 09:14:24,698 [ 212145]   FINE - #com.illuminatedcloud.intellij.util.CommandLineUtil - Returning command-line response: CommandLineResponse{exitCode=0, output='{
      "status": 0,
      "result": {
        "id": "00DS9000002hTYkMAM",
        "apiVersion": "61.0",
        "accessToken": "00DS9000002hTYk!AQEAQNIuog_fiT8UutZS7jYCT1._rAqMhpFUOG_uDWn191ETNTqAWw2anIVGQus_0t8Y_uiYKKyOQOpyHXlfZxezbhVZMTJf",
        "instanceUrl": "https://wlthdev-CompanyNameuk-wealth--scpoc2.sandbox.my.salesforce.com",
        "username": "stanislaw.zan@CompanyName.com.scpoc2",
        "clientId": "PlatformCLI",
        "connectedStatus": "Connected",
        "alias": "CompanyName-WEALTH-ASEC-Dev1"
      },
      "warnings": [
        "This command will expose sensitive information that allows for subsequent activity using your current authenticated session.\nSharing this information is equivalent to logging someone in under the current credential, resulting in unintended access and escalation of privilege.\nFor additional information, please review the authorization section of the https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_web_flow.htm."
      ]
    }
    ', error='', duration=170591}
    

    As you can see, it took 2.8 minutes (170.5 seconds) to run sf org display for one of your orgs. IC2 must have that the output of that command to be able to communicate with your Salesforce orgs, so the ultimate problem that needs to be solved is why that command is taking so incredibly long to complete. You should actually be able to reproduce that behavior directly from the command-line in isolation of IC2.

    I would recommend that you do exactly that and, assuming you see the same behavior, log a bug in the Salesforce CLI public issue tracker:

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

    They should be able to help you get diagnostic information and track down why that command is taking so long, even if it ultimately does complete, then provide thoughts on what can be done to make it behave normally. My guess is that you’ll likely have to take some of the information they provide back to your IT group to allow some additional level of (more efficient) access to the Salesforce organizations from your machine.

  3. Log in to comment