cli icon indicating copy to clipboard operation
cli copied to clipboard

Hidden directory set as --output-dir causes no metadata to be retrieved when running `sf project retrieve start`

Open BrandonEnclude opened this issue 7 months ago • 5 comments

Summary

sf project retrieve start does not retrieve any metadata when --output-dir is set to a path containing a hidden directory (ex. .tmp/force-app/main/default)

Steps To Reproduce

  1. Run the command sf project retrieve start --manifest ./manifest/package.xml --output-dir .tmp/force-app/main/default

Expected result

It should retrieve metadata from the org and put it in the directory specified as the output directory

Actual result

It retrieves nothing and prints the warning » Warning: Nothing retrieved

Additional information

The result is the same even if using an absolute path that has a hidden directory somewhere in the path (ex. C:/Users/Me/Documents/MyProject/.tmp.)

System Information

I'm debugging in Windows powershell, but I first noticed the bug in a Github Action running ubuntu-latest

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.91.6",
  "nodeVersion": "node-v20.10.0",
  "osVersion": "Windows_NT 10.0.22631",
  "rootPath": "C:\\Users\\Me\\AppData\\Roaming\\nvm\\v20.10.0\\node_modules\\@salesforce\\cli",
  "shell": "powershell",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.29 (core)",
    "@oclif/plugin-commands 4.1.25 (core)",
    "@oclif/plugin-help 6.2.28 (core)",
    "@oclif/plugin-not-found 3.2.53 (core)",
    "@oclif/plugin-plugins 5.4.38 (core)",
    "@oclif/plugin-search 1.2.24 (core)",
    "@oclif/plugin-update 4.6.41 (core)",
    "@oclif/plugin-version 2.2.28 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.40 (core)",
    "@oclif/plugin-which 3.2.35 (core)",
    "@salesforce/cli 2.91.6 (core)",
    "apex 3.6.19 (core)",
    "api 1.3.3 (core)",
    "auth 3.6.124 (core)",
    "code-analyzer 5.0.0 (user) published 36 days ago (Tue Apr 29 2025) (latest is 5.1.0)",
    "data 4.0.36 (core)",
    "deploy-retrieve 3.22.17 (core)",
    "info 3.4.65 (core)",
    "limits 3.3.55 (core)",
    "marketplace 1.3.8 (core)",
    "org 5.7.12 (core)",
    "packaging 2.13.6 (core)",
    "schema 3.3.64 (core)",
    "settings 2.4.29 (core)",
    "signups 2.5.23 (user) published 235 days ago (Sun Oct 13 2024) (latest is 2.6.28)",
    "sobject 1.4.58 (core)",
    "telemetry 3.6.42 (core)",
    "templates 56.3.48 (core)",
    "trust 3.7.96 (core)",
    "user 3.6.24 (core)",
    "@salesforce/sfdx-scanner 4.7.0 (user) published 218 days ago (Tue Oct 29 2024) (latest is 4.12.0)"
  ]
}

BrandonEnclude avatar Jun 05 '25 07:06 BrandonEnclude

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.

github-actions[bot] avatar Jun 05 '25 07:06 github-actions[bot]

Hello @BrandonEnclude :wave: None of the versions of sf you shared match the latest release.

Shared: 2.90.4 Latest: 2.91.6

Update to the latest version of Salesforce CLI (docs) and confirm that you're still seeing your issue. You can also try the rc and nightly releases! (docs)

After updating, share the full output of sf version --verbose --json

github-actions[bot] avatar Jun 05 '25 07:06 github-actions[bot]

Hello @BrandonEnclude :wave: None of the versions of sf you shared match the latest release.

Shared: 2.90.4, 2.90.4 Latest: 2.91.6

Update to the latest version of Salesforce CLI (docs) and confirm that you're still seeing your issue. You can also try the rc and nightly releases! (docs)

After updating, share the full output of sf version --verbose --json

github-actions[bot] avatar Jun 05 '25 07:06 github-actions[bot]

I've confirmed the same behavior in the latest CLI

 ➜  mkdir .hidden  
➜  dreamhouse-lwc git:(main)  hub:(GLOBAL - DevHub) scratch:([email protected])
 ➜  ls
bin                 CONTRIBUTION.md     jest-sa11y-setup.js package.json
CODE_OF_CONDUCT.md  data                jest.config.js      README.md
codecov.yml         dreamhouse-logo.png LICENSE             SECURITY.md
config              force-app           package-lock.json   sfdx-project.json
➜  dreamhouse-lwc git:(main)  hub:(GLOBAL - DevHub) scratch:([email protected])
 ➜  ls -la                                                                           
total 1216
drwxr-xr-x   2 william.ruemmele  staff      64 Jun  5 07:03 .hidden

➜  dreamhouse-lwc git:(main)  hub:(GLOBAL - DevHub) scratch:([email protected])
 ➜  sf project retrieve start -m ApexClass --output-dir .hidden/    

 ────────────── Retrieving Metadata ──────────────

 Retrieving v60.0 metadata from [email protected] using the v63.0 SOAP API

 ✔ Preparing retrieve request 7ms
 ✔ Sending request to org 3.57s
 ✔ Waiting for the org to respond 4.16s
 ✔ Done 0ms

 Status: Succeeded
 Elapsed Time: 7.73s

 ›   Warning: Nothing retrieved
➜  dreamhouse-lwc git:(main)  hub:(GLOBAL - DevHub) scratch:([email protected])
 ➜  mkdir hidden 
➜  dreamhouse-lwc git:(main)  hub:(GLOBAL - DevHub) scratch:([email protected])
 ➜  sf project retrieve start -m ApexClass --output-dir hidden/ 

 ────────────── Retrieving Metadata ──────────────

 Retrieving v60.0 metadata from [email protected] using the v63.0 SOAP API

 ✔ Preparing retrieve request 7ms
 ✔ Sending request to org 832ms
 ✔ Waiting for the org to respond 378ms
 ✔ Done 0ms

 Status: Succeeded
 Elapsed Time: 1.21s


Retrieved Source
┌─────────┬──────────────────────────┬───────────┬──────────────────────────────────────────────────────┐
│ State   │ Name                     │ Type      │ Path                                                 │
├─────────┼──────────────────────────┼───────────┼──────────────────────────────────────────────────────┤
│ Created │ FileUtilities            │ ApexClass │ hidden/classes/FileUtilities.cls                     │
│ Created │ FileUtilities            │ ApexClass │ hidden/classes/FileUtilities.cls-meta.xml            │
│ Created │ FileUtilitiesTest        │ ApexClass │ hidden/classes/FileUtilitiesTest.cls                 │
│ Created │ FileUtilitiesTest        │ ApexClass │ hidden/classes/FileUtilitiesTest.cls-meta.xml        │
│ Created │ GeocodingService         │ ApexClass │ hidden/classes/GeocodingService.cls                  │
│ Created │ GeocodingService         │ ApexClass │ hidden/classes/GeocodingService.cls-meta.xml         │
│ Created │ GeocodingServiceTest     │ ApexClass │ hidden/classes/GeocodingServiceTest.cls              │
│ Created │ GeocodingServiceTest     │ ApexClass │ hidden/classes/GeocodingServiceTest.cls-meta.xml     │
│ Created │ PagedResult              │ ApexClass │ hidden/classes/PagedResult.cls                       │
│ Created │ PagedResult              │ ApexClass │ hidden/classes/PagedResult.cls-meta.xml              │
│ Created │ PropertyController       │ ApexClass │ hidden/classes/PropertyController.cls                │
│ Created │ PropertyController       │ ApexClass │ hidden/classes/PropertyController.cls-meta.xml       │
│ Created │ SampleDataController     │ ApexClass │ hidden/classes/SampleDataController.cls              │
│ Created │ SampleDataController     │ ApexClass │ hidden/classes/SampleDataController.cls-meta.xml     │
│ Created │ TestPropertyController   │ ApexClass │ hidden/classes/TestPropertyController.cls            │
│ Created │ TestPropertyController   │ ApexClass │ hidden/classes/TestPropertyController.cls-meta.xml   │
│ Created │ TestSampleDataController │ ApexClass │ hidden/classes/TestSampleDataController.cls          │
│ Created │ TestSampleDataController │ ApexClass │ hidden/classes/TestSampleDataController.cls-meta.xml │
└─────────┴──────────────────────────┴───────────┴──────────────────────────────────────────────────────┘


WillieRuemmele avatar Jun 05 '25 13:06 WillieRuemmele

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

git2gus[bot] avatar Jun 05 '25 13:06 git2gus[bot]

quick update:

after investigating the root cause of this bug we found the fix is risky since it will change the default forceignore rules (which includes dirs starting with .). As a workaround you avoid saving retrieves to a hidden dir.

cristiand391 avatar Aug 22 '25 20:08 cristiand391