forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
493 stars 78 forks source link

Simple Retrieve or Org Browser does not work #2399

Closed JodieM closed 11 months ago

JodieM commented 1 year ago

Note Before you submit your issue, make sure that:

  • You're using the latest version of Salesforce CLI. Yes
  • You've searched both open and closed issues for related posts. Tried
  • You've used the doctor command to diagnose common issues. Yes
  • You understand that GitHub Issues don't adhere to any agreement or SLA. Yes
    • If you require immediate assistance, use official channels such as Salesforce Customer Support.

Summary

running sf retrieve start does not retrieve anything. downloading anything from the org browser does not download anything, but no errors.

Steps To Reproduce

See Video here https://www.loom.com/share/97391521912641a39875a21272162f9f?sid=cf8e0d08-ffc1-4d64-8e7b-a6be12ae47a8 Basic steps

  1. Clone code from main branch on https://github.com/SFDO-Community/Salesforce-Indicators
  2. Create new Scratch org
  3. Deploy code to org
  4. Modify a Lightning Page (eg Lead) to add the component to the page
  5. run sf project retrieve start
    sf project retrieve start
    (Use `node --trace-warnings ...` to show where the warning was created)
    Retrieving v58.0 metadata from test-5mywem51yjvh@example.com using the v58.0 SOAP API
    Preparing retrieve request... Succeeded
    »   Warning: Nothing retrieved
  6. Open Org Browser
  7. Download newly created Lead Flexipage
  8. No errors, nothing downloaded.

Expected result

I expect any changes made in the org will be retrieved from the org

Actual result

nothing is retrieved.

Troubleshooting:

System Information

Powershell Windows 11

{
  "cliVersion": "@salesforce/cli/2.3.8",
  "architecture": "win32-x64",
  "nodeVersion": "node-v20.3.0",
  "osVersion": "Windows_NT 10.0.22621",
  "shell": "cmd.exe",
  "rootPath": "C:\\Users\\JodieM\\AppData\\Roaming\\npm\\node_modules\\@salesforce\\cli",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 2.3.3 (core)",
    "@oclif/plugin-commands 2.2.21 (core)",
    "@oclif/plugin-help 5.2.15 (core)",
    "@oclif/plugin-not-found 2.3.34 (core)",
    "@oclif/plugin-plugins 3.1.8 (core)",
    "@oclif/plugin-search 0.0.21 (core)",
    "@oclif/plugin-update 3.1.28 (core)",
    "@oclif/plugin-version 1.3.8 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.46 (core)",
    "@oclif/plugin-which 2.2.29 (core)",
    "@salesforce/cli 2.3.8 (core)",
    "apex 2.3.9 (core)",
    "auth 2.8.10 (core)",
    "data 2.5.4 (core)",
    "deploy-retrieve 1.16.5 (core)",
    "info 2.6.35 (core)",
    "limits 2.3.27 (core)",
    "login 1.2.23 (core)",
    "org 2.9.28 (core)",
    "schema 2.3.21 (core)",
    "settings 1.4.21 (core)",
    "sobject 0.1.42 (core)",
    "source 2.10.28 (core)",
    "telemetry 2.2.3 (core)",
    "templates 55.5.7 (core)",
    "trust 2.5.1 (core)",
    "user 2.3.27 (core)"
  ]
}

Additional information

doctor command output


{
  "versionDetail": {
    "cliVersion": "@salesforce/cli/2.3.8",
    "architecture": "win32-x64",
    "nodeVersion": "node-v20.3.0",
    "osVersion": "Windows_NT 10.0.22621",
    "shell": "cmd.exe",
    "rootPath": "C:\\Users\\JodieM\\AppData\\Roaming\\npm\\node_modules\\@salesforce\\cli",
    "pluginVersions": [
      "@oclif/plugin-autocomplete 2.3.3 (core)",
      "@oclif/plugin-commands 2.2.21 (core)",
      "@oclif/plugin-help 5.2.15 (core)",
      "@oclif/plugin-not-found 2.3.34 (core)",
      "@oclif/plugin-plugins 3.1.8 (core)",
      "@oclif/plugin-search 0.0.21 (core)",
      "@oclif/plugin-update 3.1.28 (core)",
      "@oclif/plugin-version 1.3.8 (core)",
      "@oclif/plugin-warn-if-update-available 2.0.46 (core)",
      "@oclif/plugin-which 2.2.29 (core)",
      "@salesforce/cli 2.3.8 (core)",
      "apex 2.3.9 (core)",
      "auth 2.8.10 (core)",
      "data 2.5.4 (core)",
      "deploy-retrieve 1.16.5 (core)",
      "info 2.6.35 (core)",
      "limits 2.3.27 (core)",
      "login 1.2.23 (core)",
      "org 2.9.28 (core)",
      "schema 2.3.21 (core)",
      "settings 1.4.21 (core)",
      "sobject 0.1.42 (core)",
      "source 2.10.28 (core)",
      "telemetry 2.2.3 (core)",
      "templates 55.5.7 (core)",
      "trust 2.5.1 (core)",
      "user 2.3.27 (core)"
    ]
  },
  "sfdxEnvVars": [],
  "sfEnvVars": [
    [
      "SF_AUTOUPDATE_DISABLE",
      "true"
    ],
    [
      "SF_DISABLE_AUTOUPDATE",
      "true"
    ],
    [
      "SF_UPDATE_INSTRUCTIONS",
      "Use \"npm update --global @salesforce/cli\" to update npm-based installations."
    ]
  ],
  "cliConfig": {
    "_base": "@oclif/core@2.11.5",
    "debug": 0,
    "topicSeparator": " ",
    "warned": false,
    "commandPermutations": {
      "validPermutations": {}
    },
    "topicPermutations": {
      "validPermutations": {}
    },
    "_commands": {},
    "_topics": {},
    "root": "C:\\Users\\JodieM\\AppData\\Roaming\\npm\\node_modules\\@salesforce\\cli",
    "name": "@salesforce/cli",
    "version": "2.3.8",
    "channel": "stable",
    "valid": true,
    "arch": "x64",
    "platform": "win32",
    "windows": true,
    "bin": "sf",
    "binAliases": [
      "sfdx"
    ],
    "nsisCustomization": "scripts/nsis.nsi",
    "dirname": "sf",
    "flexibleTaxonomy": true,
    "userAgent": "@salesforce/cli/2.3.8 win32-x64 node-v20.3.0",
    "shell": "cmd.exe",
    "home": "C:\\Users\\JodieM",
    "cacheDir": "C:\\Users\\JodieM\\AppData\\Local\\sf",
    "configDir": "C:\\Users\\JodieM\\AppData\\Local\\sf",
    "dataDir": "C:\\Users\\JodieM\\AppData\\Local\\sf",
    "errlog": "C:\\Users\\JodieM\\AppData\\Local\\sf\\error.log",
    "nodeEngine": ">=14.0.0"
  },
  "pluginSpecificData": {
    "@salesforce/plugin-source": [
      {
        "sourceApiVersion": "58.0",
        "targetDevHubApiVersion": "58.0",
        "targetOrgApiVersion": "58.0"
      }
    ]
  },
  "diagnosticResults": [
    {
      "testName": "salesforcedx plugin not installed",
      "status": "pass"
    },
    {
      "testName": "no linked plugins",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-source] sourceApiVersion matches apiVersion",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-source] default target DevHub max apiVersion matches default target org max apiVersion",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-source] sourceApiVersion matches default target org max apiVersion",
      "status": "pass"
    },
    {
      "testName": "using latest or latest-rc CLI version",
      "status": "pass"
    }
  ],
  "suggestions": [
    "Check https://github.com/forcedotcom/cli/issues for CLI issues posted by the community.",
    "Check http://status.salesforce.com for general Salesforce availability and performance."
  ],
  "logFilePaths": [],
  "commandExitCode": 0
}```
github-actions[bot] commented 1 year ago

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.

git2gus[bot] commented 1 year ago

This issue has been linked to a new work item: W-13948754

JodieM commented 1 year ago

Is there any update or workaround for this issue please? I really need to be able to retrieve something from a scratch org. I am currently setting up my third demo scratch org from scratch due to this issue.

shetzel commented 1 year ago

I can tell you that the flow you describe absolutely works from the CLI. We have many tests that prove this basic functionality before any changes are made to the CLI plugins and libraries. That said, the video you linked (thank you for that) is mostly from VS Code, so you may want to uninstall VS Code and reinstall. Before you do that though, what you are seeing may be due to targeting the wrong org. If you make changes in a different org then pull (or retrieve) it won't find anything. You can explicitly target the org you want to retrieve from using the CLI (--target-org flag). If the SourceMember query you are running works, then the pull should also work since it runs that same query to build the manifest that it uses for the retrieve.

It might be worth doing your flow only using the CLI from a shell to see if it reproduces. If it doesn't, then I'd suspect something is messed up in VS Code extensions.

JodieM commented 1 year ago

OK explicitly setting the org worked and I was able to retrieve, however, I've always created my scratch orgs as the default, only usually have one scratch org on the go, and it's showing in the bottom left hand corner of VSCode as the default. I've followed the steps here https://trailhead.salesforce.com/content/learn/projects/quick-start-salesforce-dx/create-and-test-our-scratch-org and their deploy command doesn't set an org explicitly so I wonder what has changed in the new SF commands that you have to set the org?

shetzel commented 1 year ago

If you're creating multiple scratch orgs and defaults, it might be replacing 1 default with another. You can check the default (from the CLI) with sf config list. It appears that the mix of VS Code actions and CLI commands with multiple scratch orgs might be causing some confusion. New sf CLI commands work the same way as sfdx CLI commands w.r.t how default orgs are applied.

shetzel commented 11 months ago

Here is your problem: https://github.com/SFDO-Community/Salesforce-Indicators/blob/main/.forceignore#L22

You can't forceignore **/unpackaged/** or everything from a retrieve will be ignored because that's the directory within the retrieved zip file that all unpackaged metadata goes. E.g., unpackaged/flexipages/Lead_Record_Page If you comment that entry or remove it, then do your retrieve it works.

Maybe we can add a warning when parsing the .forceignore file if we see something like that.