forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
486 stars 78 forks source link

SFDX CLI crashes while incorrectly handling Windows file/pathname during 'sfdx force:mdapi:convert' #781

Closed AltiusRupert closed 2 years ago

AltiusRupert commented 3 years ago

Summary

SFDX CLI crashes while incorrectly handling Windows file/pathname during 'sfdx force:mdapi:convert'

Steps To Reproduce:

Repository to reproduce: ebikes-lwc

  1. Clone repo and create scratch org as documented in the repo README

  2. Create file ebikes-lwc/package.xml on Windows PC with the following content : <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

    * ExperienceBundle * Network * CustomSite 50.0
  3. In VSCode, right-click on this file and select 'SFDX : Retrieve source in manifest from org', which is equivalent to the following commands : sfdx force:mdapi:retrieve --retrievetargetdir C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes --unpackaged C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\package.xml --targetusername ebikes sfdx force:mdapi:convert --rootdir C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\unpackaged --outputdir C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\converted

  4. Notice the error message "UnhandledPromiseRejectionWarning: Error: g:\Mon Drive\Documents\DVT\WORKSPACE-PC\client-fBRD\bug\ebikes-lwc\C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\converted\main\default\experiences\E_Bikes1\brandingSets contains invalid WIN32 path characters."

Expected result

This command should finish without an error

Actual result

Error message : UnhandledPromiseRejectionWarning: Error: g:\Mon Drive\Documents\DVT\WORKSPACE-PC\client-FBRD\bug\ebikes-lwc\C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\converted\main\default\experiences\E_Bikes1\brandingSets contains invalid WIN32 path characters.

Full trace : 18:28:57.209 sfdx force:mdapi:retrieve --retrievetargetdir C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes --unpackaged C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\package.xml --targetusername ebikes Retrieving source...

=== Status Status: InProgress jobid: 09S1X000001XUwCUAW

=== Result Status: Succeeded jobid: 09S1X000001XUwCUAW

Wrote retrieve zip to C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\unpackaged.zip. 18:29:07.461 sfdx force:mdapi:retrieve --retrievetargetdir C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes --unpackaged C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\package.xml --targetusername ebikes ended with exit code 0

Starting Conflict Detection: converting org source

18:29:07.566 sfdx force:mdapi:convert --rootdir C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\unpackaged --outputdir C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\converted (node:8324) UnhandledPromiseRejectionWarning: Error: g:\Mon Drive\Documents\DVT\WORKSPACE-PC\client-FBRD\bug\ebikes-lwc\C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\converted\main\default\experiences\E_Bikes1\brandingSets contains invalid WIN32 path characters. at Object.mkdirsSync (C:\Users\Rupert\AppData\Local\sfdx\client\7.82.0-3d0c527ac6\node_modules\salesforce-alm\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:18:22) at Proxy.copySync (C:\Users\Rupert\AppData\Local\sfdx\client\7.82.0-3d0c527ac6\node_modules\salesforce-alm\node_modules\fs-extra\lib\copy-sync\copy-sync.js:42:34) at ExperienceBundleContentStrategy.saveContent (C:\Users\Rupert\AppData\Local\sfdx\client\7.82.0-3d0c527ac6\node_modules\salesforce-alm\dist\lib\source\decompositionStrategy\nonDecomposedContentStrategy.js:59:20) at ExperienceBundleContentStrategy.saveContent (C:\Users\Rupert\AppData\Local\sfdx\client\7.82.0-3d0c527ac6\node_modules\salesforce-alm\dist\lib\source\decompositionStrategy\experienceBundleContentStrategy.js:29:76) at AggregateSourceElement.commitContent (C:\Users\Rupert\AppData\Local\sfdx\client\7.82.0-3d0c527ac6\node_modules\salesforce-alm\dist\lib\source\aggregateSourceElement.js:328:121) at AggregateSourceElement.commit (C:\Users\Rupert\AppData\Local\sfdx\client\7.82.0-3d0c527ac6\node_modules\salesforce-alm\dist\lib\source\aggregateSourceElement.js:291:24) at async SourceWorkspaceAdapter.updateSource (C:\Users\Rupert\AppData\Local\sfdx\client\7.82.0-3d0c527ac6\node_modules\salesforce-alm\dist\lib\source\sourceWorkspaceAdapter.js:247:93) at async Walker. (C:\Users\Rupert\AppData\Local\sfdx\client\7.82.0-3d0c527ac6\node_modules\salesforce-alm\dist\lib\source\mdapiConvertApi.js:416:25) (node:8324) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:8324) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 18:29:14.402 sfdx force:mdapi:convert --rootdir C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\unpackaged --outputdir C:\Users\Rupert\AppData\Local\Temp.sfdx\tools\conflicts\ebikes\converted ended with exit code 0

Additional information

FYI, my local work folder on Windows PC is a folder stored in Google File Stream, mounted on g: drive at g:\Mon Drive\Documents\DVT\WORKSPACE-PC\client-FBRD\bug\ebikes-lwc

SFDX CLI Version(to find the version of the CLI engine run sfdx --version): $ sfdx -v sfdx-cli/7.82.0-3d0c527ac6 win32-x86 node-v12.18.3

SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core) $ sfdx plugins --core @oclif/plugin-autocomplete 0.1.5 (core) @oclif/plugin-commands 1.3.0 (core) @oclif/plugin-help 3.2.0 (core) @oclif/plugin-not-found 1.2.4 (core) @oclif/plugin-plugins 1.9.4 (core) @oclif/plugin-update 1.3.10 (core) @oclif/plugin-warn-if-update-available 1.7.0 (core) @oclif/plugin-which 1.0.3 (core) @salesforce/sfdx-trust 3.4.3 (core) alias 1.1.3 (core) analytics 1.12.1 (core) auth 1.3.0 (core) config 1.2.1 (core) generator 1.1.3 (core) salesforcedx 50.7.0 (core) ├─ schema 1.0.1 (core) ├─ templates 50.1.0 (core) ├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core) ├─ custom-metadata 1.0.10 (core) ├─ apex 0.1.4 (core) └─ salesforce-alm 50.7.0 (core) sfdmu 3.7.21 sfdx-cli 7.82.0 (core)

OS and version: Windows 10 Professionnel, version 2004, OS version 19041.685, Windiws Feature Experience Pack 120.2212.551.0

github-actions[bot] commented 3 years ago

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.

mshanemc commented 2 years ago

Does this still happen?

If so, can you test it with the new sfdx force:mdapi:beta:convert to see if it happens there?

RupertBarrow commented 2 years ago

Hi Shane, I only used windows exceptionally during the repair of my Mac. Are you asking me to test a fix, or to check whether it is still reproduceable ? I will need to pull out a PC, set up environment etc. Will take some time. Is it necessary for you ?

no-response[bot] commented 2 years ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. Currently, there is not enough information provided for us to take action. Please reply and reopen this issue if you need additional assistance.