cli icon indicating copy to clipboard operation
cli copied to clipboard

sfdx Deploying w Unreleased API Version by Default

Open scottbcovert opened this issue 3 years ago • 7 comments
trafficstars

Summary

This AM I started having issues with sfdx force:source:deploy -p ... pushing source w/ API version 56.0 (upcoming/unreleased Winter '23) by default. I eventually just forced the API version used by sfdx to be 55.0 but another dev just reported seeing the same thing also starting this AM. We both initially were on sfx-cli/7.161.0 and then upgraded to sfdx-cli/7.162.0 with no effect.

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc

  1. Remove the specific sourceApiVersion value from sfdx-project.json that would otherwise force sfdx to deploy using v55.0
  2. Run sfdx force:source:deploy -p force-app against a new scratch org spun up with Summer '22 (v55.0)
  3. Confirm deployment fails with the following message Error package.xml Invalid version specified:56.0

Expected result

sfdx should use latest released version of API (v55.0) for deployment, which should then succeed.

Actual result

sfdx attempts to deploy using unreleased API version v56.0, which results in the deployment failing.

System Information

  • I am using zsh
{
        "cliVersion": "sfdx-cli/7.162.0",
        "architecture": "darwin-x64",
        "nodeVersion": "node-v14.16.1",
        "pluginVersions": [
                "@oclif/plugin-autocomplete 0.3.0 (core)",
                "@oclif/plugin-commands 1.3.0 (core)",
                "@oclif/plugin-help 3.3.1 (core)",
                "@oclif/plugin-not-found 1.2.6 (core)",
                "@oclif/plugin-plugins 1.10.11 (core)",
                "@oclif/plugin-update 1.5.0 (core)",
                "@oclif/plugin-warn-if-update-available 1.7.3 (core)",
                "@oclif/plugin-which 1.0.4 (core)",
                "@salesforce/sfdx-plugin-lwc-test 1.0.0 (core)",
                "alias 2.1.0 (core)",
                "apex 1.1.0 (core)",
                "auth 2.2.3 (core)",
                "community 2.0.0 (core)",
                "config 1.4.14 (core)",
                "custom-metadata 2.0.0 (core)",
                "data 2.1.1 (core)",
                "generator 2.0.2 (core)",
                "info 2.0.1 (core)",
                "limits 2.0.1 (core)",
                "org 2.0.7 (core)",
                "rest-explorer 0.0.0",
                "salesforce-alm 54.6.4 (core)",
                "schema 2.1.1 (core)",
                "sfdx-cli 7.162.0 (core)",
                "shane-sfdx-plugins 4.43.0",
                "├─ @mshanemc/plugin-streaming 1.1.7",
                "└─ @mshanemc/sfdx-sosl 1.1.0",
                "signups 1.2.0 (core)",
                "source 2.0.11 (core)",
                "telemetry 2.0.0 (core)",
                "templates 55.0.0 (core)",
                "trust 2.0.2 (core)",
                "user 2.1.0 (core)"
        ],
        "osVersion": "Darwin 18.7.0"
}

scottbcovert avatar Aug 04 '22 17:08 scottbcovert

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 Aug 04 '22 17:08 github-actions[bot]

I'm seeing the same error this morning with sfdx force:source:push --loglevel fatal --forceoverwrite until I add "sourceApiVersion": "55.0" to sfdx-project.json.

chivalry avatar Aug 04 '22 17:08 chivalry

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

git2gus[bot] avatar Aug 04 '22 17:08 git2gus[bot]

Thanks for reporting the issue. We have determined the cause. The workaround will require the presence of property sourceApiVersion in your project json.

peternhale avatar Aug 04 '22 18:08 peternhale

Thanks for jumping on this, @peternhale

scottbcovert avatar Aug 04 '22 19:08 scottbcovert

I also started to see this and some really unhelpful error messages. I am using VS Code (Salesforce Extension Pack 55.8.0) to deploy and kept receiving the following response even when I knew 100% there were changes to deploy:

=== Pushed Source
No results found

I eventually looked at the Deployment Status in Setup, and this is where I saw the deploys failed with the following Invalid version specified error. And while the error references package.xml I am doing source development to a scratch org and do not have a package.xml file. Screen Shot 2022-08-05 at 11 48 00 PM

It is also worth noting that I have set the "sourceApiVersion": "52.0", value in the project.json file, but it is not being used by SFDX in VS Code.

My workaround, for now, is to manually run sfdx commands and not use VS Code to deploy on save, as this does not currently work.

tehnrd avatar Aug 06 '22 06:08 tehnrd

Update on my issue. I have a monorepo with the managed package, some AWS code, and documentation. In the root of the entire project directory, I have a lightweight sfdx-project.json file as this is required for the SFDX tools within VS Code to load. I have another sfdx-project.json in the package directory for package-specific properties such as versioning, namespace, etc.

Adding sourceApiVersion to the root sfdx-project.json file resolved my issue.

{
  "sourceApiVersion": "55.0",
  "packageDirectories": [
    {
      "path": "packages/package/force-app",
      "default": true
    },
    {
      "path": "packages/package/unpackaged",
      "default": false
    }
  ]
}

tehnrd avatar Aug 06 '22 07:08 tehnrd

@mshanemc is the solution to this to always specify the sourceApiVersion?

pgonzaleznetwork avatar Jan 15 '24 12:01 pgonzaleznetwork

yeah, I'd always recommend specifying sourceApiVersion in the project. The sf project generate command should set that up for you automatically.

mshanemc avatar Jan 16 '24 03:01 mshanemc