Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot retrieve or deploy using new sf CLI on production: source tracking not enabled? #2693

Closed
zqstack opened this issue Feb 6, 2024 · 4 comments
Labels
validated Version information for this issue has been validated

Comments

@zqstack
Copy link

zqstack commented Feb 6, 2024

Summary

When I run sf project retrieve start on a production Org, it says:

Error (1): This command can only be used on orgs that have source tracking enabled, such as sandboxes and scratch orgs
Is there a way to retrieve all project files locally from a production environment? Is this possible using the Salesforce CLI?

Or for sf project deploy preview --metadata x:x it shows
Error (1): This org does not have source tracking

On my sandbox this solve the issue, but I would like to do the same on production if possible in any way.

When using the old and deprecated sfdx force:source:retrieve no error is shown.

Steps To Reproduce

Running these commands on a production Org:
sf project retrieve start
or
sf project deploy preview --metadata x:x

I don't know how to simulate a production environment without giving my credentials.

Expected result

Retrieve / Deploy without errors.

Actual result

Errors were shown as described.

System Information

Using Git Bash on Windows.

sf version --verbose --json:

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.26.10",
  "nodeVersion": "node-v20.10.0",
  "osVersion": "Windows_NT 10.0.22631",
  "rootPath": "C:\\Program Files\\sf\\client",
  "shell": "C:\\Program Files\\Git\\usr\\bin\\bash.exe",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.5 (core)",
    "@oclif/plugin-commands 3.1.1 (core)",
    "@oclif/plugin-help 6.0.12 (core)",
    "@oclif/plugin-not-found 3.0.9 (core)",
    "@oclif/plugin-plugins 4.1.21 (core)",
    "@oclif/plugin-search 1.0.12 (core)",
    "@oclif/plugin-update 4.1.8 (core)",
    "@oclif/plugin-version 2.0.11 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.9 (core)",
    "@oclif/plugin-which 3.0.15 (core)",
    "@salesforce/cli 2.26.10 (core)",
    "apex 3.0.20 (core)",
    "auth 3.3.3 (core)",
    "data 3.0.17 (core)",
    "deploy-retrieve 3.2.6 (core)",
    "info 3.0.18 (core)",
    "limits 3.1.5 (core)",
    "marketplace 1.0.18 (core)",
    "org 3.3.8 (core)",
    "packaging 2.1.3 (core)",
    "schema 3.1.0 (core)",
    "settings 2.0.19 (core)",
    "sobject 1.1.3 (core)",
    "source 3.1.6 (core)",
    "telemetry 3.1.10 (core)",
    "templates 56.0.11 (core)",
    "trust 3.3.2 (core)",
    "user 3.2.4 (core)"
  ]
}
@zqstack zqstack added the investigating We're actively investigating this issue label Feb 6, 2024
Copy link

github-actions bot commented Feb 6, 2024

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 github-actions bot added the validated Version information for this issue has been validated label Feb 6, 2024
@mshanemc
Copy link
Contributor

mshanemc commented Feb 6, 2024

sf project retrieve start (with no flags) will try to retrieve the changes, and requires source tracking.

Is there a way to retrieve all project files locally from a production environment? Is this possible using the Salesforce CLI?

I'm assuming that you have "all project files"? Otherwise, how would the CLI know which files you want?
sf project retrieve start --source-dir [wherever your project files are

or sf project retrieve start --metadata x to get all the metadata of one or more types if you know what you want.

If you mean, "I have no project but I want to dump the whole org out" you can use sf project generate manifest --from-org which will try to ask the org what all metadata it has, and make that a package.xml. You could then pass that package.xml to sf project retrieve start --manifest and it would retrieve most everything. [this results in a LOT of metadata, much of which you probably don't want, and some of it might not even be deployable]

we're working to come up with a better solution for this scenario, see #2040

@mshanemc mshanemc closed this as completed Feb 6, 2024
@mshanemc mshanemc removed the investigating We're actively investigating this issue label Feb 6, 2024
@nishithcv
Copy link

Hi @mshanemc , I have enabled source tracking in my free dev org and I have tried the command sf project deploy preview but it says the tracking is not enabled in my dev org. Is it that the source tracking is only enabled in the scratch orgs that I create from free dev org and not in the dev org itself?

image

@mshanemc
Copy link
Contributor

all scratch orgs support tracking

I have enabled source tracking in my free dev org
did you toggle a switch that says Enable Source Tracking in Developer and Developer Pro Sandboxes ? If so, that turns it on for those sandbox types create from the org.

as far as I know, developer orgs, like trailhead playgrounds, don't support tracking tracking.

You should still be able to sf project retrieve start -m/-d/-x from any org.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

3 participants