5

I'm stumped on this one. I get that the error has to do with an API version mismatch, but as far as I can see everything is on the same version.

I'm trying to pull an unmanaged package from my sandbox using force:mdapi:retrieve, so that I can extract the package.xml file and use it with the new sfdx force:source:retrieve CLI command, which was released in Winter '19.

My Sandbox API is 44.0 (highest selectable version for an Apex class in dev console).

My SFDX Project API is 44.0 ("sourceApiVersion":"44.0" in sfdx-project.json). It's a new project created today expressly to test this.

My VSCode Salesforce Extension Pack is v44.11.0

Here's what I got in my VSCode terminal:

PS P:\SpreadsConsolidation> sfdx force:mdapi:retrieve -p "Spreads Consolidation" -s -u fullcopy -r ./mdpkg

Retrieving source...
ERROR:  UNSUPPORTED_API_VERSION: Invalid Api version specified on URL.

Adding the -a 44.0 flag got the same error.

What am I missing here?

  • What is you CLI version (sfdx version)? – Jayant Das Dec 18 '18 at 22:52
  • Have you by any chance updated CLI to a pre-release version? You can confirm it by running sfdx plugin. – Jayant Das Dec 18 '18 at 23:01
  • 1
    If you're using salesforcedx@pre-release, then you might want this question. Does that help? – sfdcfox Dec 18 '18 at 23:03
  • sfdx version == sfdx-cli/6.44.0-dead729fb5 (windows-x64) node-v8.9.4 – smohyee Dec 19 '18 at 13:50
  • sfdx plugins and sfdx force --version reveal the issue! Guess I'm on salesforcedx 45.0.9 (pre-release) – smohyee Dec 19 '18 at 13:51
10

Thanks to sfdcfox and the commenters above for the solution!

in CLI terminal, sfdx force --version and sfdx plugins revealed to me that even if my VSCode extensions are v44, and my CLI version is sfdx-cli/6.44.0-dead729fb5 (windows-x64) node-v8.9.4... well, apparently sfdx itself (which I thought was an abstraction) has a version #, and it was 45.

Solution is to manually override the API version used by your project

After moving into a project folder, specify a version override with the following command:

sfdx force:config:set apiVersion=44.0 This will allow you to use the newer 45.0 features in a LWC project, whilst still being able to work in a 44.0 org without any errors.

Make sure that, if you're playing with an advanced version of the API, that you keep the salesforcedx@pre-release plugin installed until it is upgraded to the latest release.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.