function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Greg FinzerGreg Finzer 

SFDX ERROR: Cannot read property 'fileName' of undefined.

I am getting an error when trying to do a sfdx retrieve:
ERROR:  Cannot read property 'fileName' of undefined.

Here is the command that is being issued in VS Code when I click on the package.xml file and retrive source from org:
sfdx force:source:retrieve --manifest c:\_hilton\BossReno\manifest\package.xml

The development environment is Salesforce Spring 2019
Here is my version of sfdx:
sfdx-cli/6.53.0-67a9cbb60c (windows-x64) node-v8.9.4


This package.xml file was generated by VS Code extension.  Here it is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>ApexClass</name>
</types>
<types>
<members>*</members>
<name>ApexComponent</name>
</types>
<types>
<members>*</members>
<name>ApexPage</name>
</types>
<types>
<members>*</members>
<name>ApexTestSuite</name>
</types>
<types>
<members>*</members>
<name>ApexTrigger</name>
</types>
<types>
<members>*</members>
<name>AuraDefinitionBundle</name>
</types>
<types>
<members>*</members>
<name>StaticResource</name>
</types>
<version>45.0</version>
</Package>
Best Answer chosen by Greg Finzer
Alain CabonAlain Cabon
Hi,

It is a bug of SFDX. 

1) You can try the option: --loglevel LOGLEVEL

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

sfdx force:source:retrieve --manifest c:\_hilton\BossReno\manifest\package.xml --loglevel debug

You will found nothing interesting in this file log because it is a technical error of sfdx.

2)  Workaround: retrieve the source code by using the workbench, unzip the retrieved file into c:\workbench\bosreno  (ie)
     and launch: sfdx force:mdapi:convert --rootdir  c:\workbench\bosreno
   (instead of sfdx force:source:retrieve --manifest )
 

All Answers

Alain CabonAlain Cabon
Hi,

It is a bug of SFDX. 

1) You can try the option: --loglevel LOGLEVEL

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

sfdx force:source:retrieve --manifest c:\_hilton\BossReno\manifest\package.xml --loglevel debug

You will found nothing interesting in this file log because it is a technical error of sfdx.

2)  Workaround: retrieve the source code by using the workbench, unzip the retrieved file into c:\workbench\bosreno  (ie)
     and launch: sfdx force:mdapi:convert --rootdir  c:\workbench\bosreno
   (instead of sfdx force:source:retrieve --manifest )
 
This was selected as the best answer
Ramon Diaz 5Ramon Diaz 5
Thanks a lot Alain!! After having this issue for some weeks now I could import all my lwc and aura components into my new visual studio code folder and sync them to git. 
Alain CabonAlain Cabon
Hello Ramon,

Good news. VS Code is still very unstable with sfdx (very difficult to use). 

We are going to lose the Eclipse IDE soon (not the best tool but fairly stable after years of development).

MavensMate is officially obsolete now (the fastest and most reliable tool, very popular until recently).

VS Code is not handy at all and very slow (many command lines not well integrated which work one time in two and we never know clearly what is the problem).

A tool so unstable that experts of development with Salesforce (internal employees) only use the command lines directly by writing them in the console (copy/paste instead of the integrated commands).
 
Greg FinzerGreg Finzer
All,

I logged this as an official issue for the Salesforce CLI:
https://github.com/forcedotcom/cli/issues/39

 
Alain CabonAlain Cabon
The big problem with Lightning Web Components is that only VS Code can be used for the development for free. 

The developer console (stable) doesn't support LWC until now (only AURA Lightning).

Eclipse IDE and MavensMate disqualified now.
Greg FinzerGreg Finzer
Alain,

I have verified that the issue is not fixed.  It looks like there was a problem with their deployment.  The version did not change when I did an SFDX update.

Thanks,
Greg
Alain CabonAlain Cabon
Ok I have seen the much better Steve Hetzel's response indeed.

That is exactly what we need to know because we often struggle with the commands of upgrade for the sfdx cli itself.

A later version of the plugin (45.7.1 iirc) - that change everything when you can verify a precise version.

The difference is subtle 45.7.1 instead of  45.3.4 (sub version).
Ramon Diaz 5Ramon Diaz 5
God thanks! And how were we supposed to know that?.... :@ 
I tried to run the commands Steve mentioned on Github and the retrieve ran smoothly!!
sfdx plugins:uninstall salesforcedx
and then...
sfdx plugins --core
In my case it installed version salesforcedx 45.4.1 (core) which I guess is an ever newer version? Dunno...
 
Alain CabonAlain Cabon
"The bug you are hitting was fixed in a later version of the plugin (45.7.1 iirc)." (45.4.1)
There is typo in the Steve Hetzel's response.

45.4.1 (February 28, 2019) : very new and perhaps the first "stable" usable version?
FIX: You can now retrieve specific Lightning web components to your local project on a Windows machine using force:source:retrieve.
https://developer.salesforce.com/media/salesforce-cli/releasenotes.html

... and my first response: February 22, 2019 : this kind of problem destroyed completely the SFDX credibility (you cannot start anything). 

That changes every week in fact? The fix is very new and that will change a lot in the coming weeks probably because the SFDX credibilty is at stake.

45.3.1 (February 21, 2019):
45.2.0 (February 14, 2019)
 
Greg FinzerGreg Finzer
Those steps did not work for me. I also did a full uninstall of salesforce cli, reboot, and then re-install. I also tried the command again:
 
sfdx plugins:uninstall salesforcedx

Result
salesforcedx is not installed


When I do this:
sfdx plugins --core

I get this:
 
@salesforce/plugin-generator 1.0.1 (core)
@salesforce/sfdx-trust 2.0.1 (core)
builtins 1.0.0 (core)
salesforcedx 45.4.1 (core)

 
Alain CabonAlain Cabon
Not a surprise.  We often struggle with the commands of upgrade for the sfdx cli itself as I have written above (there are interferences with node, npm, the direct exe installation, and so on, big mess even if you uninstall an reinstall everything, that is not so simple, waste of time).

The first LWC apps were published with warnings for the "bugs" each time at the begining and that is the REFERENCE applications: https://github.com/trailheadapps
Now there are two options: sfdx command lines (that never works as expected) and the (old) unmanaged package as usual (that always works fine).

René Winkelmeyer (German) is the main Evangelist for VS Code. Christophe Coenraets  (French) published warnings for sfdx bugs until recently and Zayne Turner only uses copy/paste of the command lines for SFDX.
https://developer.salesforce.com/tv/lwc-video-gallery

Ideally, the developer console should support the development of LWC directly like the Aura lightning (stable).

The VS Code/sfdx constraint is unbearable for the development of LWC components (that never works as expected) until recently.
 
Alain CabonAlain Cabon

c:\sfdx>sfdx plugins:uninstall salesforcedx
Uninstalling plugin salesforcedx... done

c:\sfdx>sfdx plugins --core

@salesforce/plugin-generator 1.0.1 (core)
@salesforce/sfdx-trust 2.0.1 (core)
builtins 1.0.0 (core)
salesforcedx 45.3.4 (core)

( ... uninstall done and ... still there???   It is not so simple )

c:\sfdx>sfdx update     
sfdx-cli: Updating to 6.56.0-e3fd846a1f... 21.1 MB/21.1 MB
sfdx-cli: Updating CLI... already on latest version: 6.56.0-e3fd846a1f
sfdx-cli: Updating plugins... done

c:\sfdx>sfdx plugins --core
@salesforce/plugin-generator 1.0.1 (core)
@salesforce/sfdx-trust 2.1.0 (core)
builtins 1.0.0 (core)
salesforcedx 45.5.0 (core)

https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_update_cli.htm

Warning: sfdx update is very slow and you will need to delete the update.lock (otherwise that will never work) 

 !    autoupdate:: C:\Users\<your user>\AppData\Local\sfdx\update.lock is locked with an active writer

And we need to upgrade sdfx every ... day (ideally) because that changes all the time and that tool is still very unstable (many bugs).
Alain CabonAlain Cabon
The "good" version will be released soon. 

45.5.0 (March 7, 2019)
We are migrating the cli-engine framework over to Heroku's Open CLI Framework (oclif) in the coming weeks. This migration is a major update for Salesforce CLI and our core plug-ins. To allow time for testing and to facilitate a smooth transition, we will not be releasing updates for the next 3 weeks. We plan to release our next update, v45.8.x of the salesforcedx aggregate plug-in and and v7.x.x of sfdx-cli, on Thursday, March 28, 2019.
We expect this change to improve the performance and reliability of Salesforce CLI and to help us add new functionality more quickly. Migrating Salesforce CLI to oclif will not change the way you interact with the CLI, and the force commands will work as they did before. However, Salesforce CLI will NOT be backwards compatible with plug-ins built on the original CLI engine. If the plug-in was created using Salesforce Plug-In Generator (sfdx plugins:generate), it will still work, because the generator already uses oclif. To learn more about oclif, you can visit their website.

https://developer.salesforce.com/media/salesforce-cli/releasenotes.html