As part of the Summer '20 update to IC, I've implemented support for LWC style components. These seem to deploy just fine using force:source:deploy, but if you try to retrieve one using force:source:retrieve, you get an error:
sfdx force:source:retrieve -p force-app/main/default/lwc/cssLibrary --json
{
"status": 1,
"name": "TypeError",
"message": "Cannot read property 'fileName' of undefined",
"exitCode": 1,
"commandName": "SourceRetrieveCommand",
"stack": "TypeError: Cannot read property 'fileName' of undefined\n at Function.getMetadataFileNameFromBundleFileProperties (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\dist\\lib\\source\\bundlePathHelper.js:41:48)\n at Function.getPathFromBundleTypeFileProperties (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\dist\\lib\\source\\bundlePathHelper.js:35:43)\n at LightningComponentBundleMetadataType.getDefaultAggregateMetadataPath (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\dist\\lib\\source\\metadataTypeImpl\\bundleMetadataType.js:30:52)\n at SourceWorkspaceAdapter.processMdapiFileProperty (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\dist\\lib\\source\\sourceWorkspaceAdapter.js:270:59)\n at C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\dist\\lib\\source\\sourcePullApi.js:163:22\n at Array.forEach (<anonymous>)\n at MdapiPullApi._syncDownSource (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\dist\\lib\\source\\sourcePullApi.js:156:31)\n at SourceRetrieve.retrieveFromManifest (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\dist\\lib\\source\\sourceRetrieve.js:138:56)\n at processTicksAndRejections (internal/process/task_queues.js:93:5)\n at async SourceRetrieve.retrieve (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\dist\\lib\\source\\sourceRetrieve.js:62:27)\n at async SourceRetrieveCommand.execute (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\dist\\lib\\source\\sourceRetrieveCommand.js:31:16)\n at async SourceRetrieveCommand.execLegacyCommand (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\dist\\ToolbeltCommand.js:148:29)\n at async SourceRetrieveCommand.run (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\dist\\commands\\force\\source\\retrieve.js:27:16)\n at async SourceRetrieveCommand._run (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\node_modules\\@salesforce\\command\\lib\\sfdxCommand.js:91:40)\n at async Config.runCommand (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.65.6-23e8b7f47e\\node_modules\\@oclif\\config\\lib\\config.js:172:9)\n at async Main.run (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.65.6-23e8b7f47e\\node_modules\\@oclif\\command\\lib\\main.js:22:9)\nOuter stack:\n at Function.wrap (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\node_modules\\@salesforce\\core\\lib\\sfdxError.js:151:27)\n at SourceRetrieveCommand.catch (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\dist\\ToolbeltCommand.js:246:46)\n at async SourceRetrieveCommand._run (C:\\Users\\Scott\\AppData\\Local\\sfdx\\node_modules\\salesforce-alm\\node_modules\\@salesforce\\command\\lib\\sfdxCommand.js:95:13)\n at async Config.runCommand (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.65.6-23e8b7f47e\\node_modules\\@oclif\\config\\lib\\config.js:172:9)\n at async Main.run (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.65.6-23e8b7f47e\\node_modules\\@oclif\\command\\lib\\main.js:22:9)\n at async Main._run (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.65.6-23e8b7f47e\\node_modules\\@oclif\\command\\lib\\command.js:43:20)\n at async Object.run (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.65.6-23e8b7f47e\\dist\\cli.js:32:20)",
"warnings": []
}
This is on today's latest build:
sfdx plugins
@salesforce/lwc-dev-server 2.4.0
鈹溾攢 @oclif/plugin-update 1.3.9
鈹斺攢 @oclif/plugin-help 2.2.3
salesforcedx 48.22.11
鈹溾攢 salesforcedx-templates 48.18.0
鈹溾攢 salesforce-alm 48.24.3
鈹溾攢 @salesforce/sfdx-plugin-lwc-test 0.1.7
鈹斺攢 custom-metadata 1.0.4
Could be the same root cause as #488 so we'll make sure this works when fixing that issue. Thanks Scott!
@shetzel that certainly looks like it could be related. Thanks for looking into it (actually, both of them!). I'll keep logging issues for things that I and/or my IC users find so you guys have them on your radar.
@shetzel I just emailed @ntotten, @clairebianchi, and @amphro about this, but while not strictly CLI-related, deployment of LWC components which import other LWC style components is now broken. Any attempt now fails with lwc/scottComponent/scottComponent.js: ERROR - No MODULE named markup://c:cssLibrary found : [markup://c:scottComponent]. I don't know if perhaps something was changed in the server for some of these fixes that might have introduced this regression. It's very simple to reproduce, though. Just create and deploy an LWC style component, then create another LWC component that imports the first component in its CSS file and try to deploy it.
Thanks, tracked internally as W-7868812 and actively being investigated/fixed.
The fix for this will be in the next patch release. Sorry for the delay.
ERROR running force:source:retrieve: Cannot read property 'fileName' of undefined
There are 2 separate issues reported here; a CLI issue and serverside deployment issue. The CLI issue (retrieve) will be fixed with the next CLI patch release. The serverside deploy issue will take a bit longer, and not by the CLI team. I'm going to close this one and track them with 2 others.
CLI retrieve issue: #563
Serverside deploy issue: #627