Cli: mdapi convert command fails when source has lightning web component bundle

Created on 15 Feb 2019  路  33Comments  路  Source: forcedotcom/cli

Summary

_Short summary of what is going on or to provide context_.

mdapi convert command fails when source has lightning web component bundle

I ran into the same issue reported by Mohith via Salesforce stack exchange.

Created the issue here so we can track it. This is a blocker for any teams to use LWC.

Steps To Reproduce:

  1. Create an unmanaged package in Developer Edition org with lwc bundle and retrieve src by package name or clone the git repo here https://github.com/msrivastav13/mdapi-convert-lwc-bug.git

  2. sfdx force:mdapi:convert -r ./mdapiout -d force-app

Expected result

Conversion should be performed successfully

Actual result

The error in the console is as below

An error was encountered processing path: /mdapio ut/src/lwc//.html.

_Feel free to attach a screenshot_.

SFDX CLI Version(to find the version of the CLI engine run sfdx --version):
sfdx-cli/6.52.2-c6cdc99881

SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)
salesforcedx 45.1.2

OS and version:
Any

bug

Most helpful comment

I am seeing same error on pre-release for force:mdapi:retrieve

An error was encountered during conflict detection. ERROR running force:mdapi:convert:

An error was encountered processing path: /var/folders/xb/h6kpy82n46lc1whxr_xdg4kw0000gn/T/.sfdx/tools/conflicts/***/unpackaged/classes/ABC.cls

sfdx version: sfdx-cli/7.74.1-32db2396ed
salesforcedx 50.1.1 (pre-release)

OS: Any

All 33 comments

also, the reverse direction (DX to Mdapi) is also failing with the same error. @clairebianchi & team let me know if you need any other details.

any ideas when this might get fixed ? we're thinking of implementing work-arounds (ie. remove lwc, convert, then copy lwc over) but this is rather ugly. Any ETA would be really helpful here.

thanks.

@jtomtran Thank you for submitting this bug. This is a known issue. We are currently working on it internally. I am going to close this issue as we are tracking it with a different team.

@clairebianchi , I'm running into this issue as well - is this on the Known Issues website so I can follow updates on it? I've had a look myself, but couldn't find it under Salesforce DX issues.

Any luck on this? I'm running into this issue as well.

@koenwesselman @Droberts359
I'm not able to reproduce this problem with the lwc source from the repo mentioned above so I believe this has been fixed with a recent patch. I would make sure you are on the latest CLI (7.4.0) and using all the core plugins. I.e., running sfdx plugins --core displays "(core)" after the salesforcedx and salesforce-alm plugins.

Hi @shetzel , after reading your comment I updated to 7.4.0-99233fd3af and checked the plugins for core:
sfdx plugins --core
@oclif/plugin-commands 1.2.2 (core)
@oclif/plugin-help 2.1.6 (core)
@oclif/plugin-not-found 1.2.2 (core)
@oclif/plugin-plugins 1.7.8 (core)
@oclif/plugin-update 1.3.9 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.0.2 (core)
analytics 1.1.2 (core)
generator 1.1.0 (core)
salesforcedx 45.11.0 (core)
鈹溾攢 force-language-services 45.10.0 (core)
鈹斺攢 salesforce-alm 45.14.0 (core)
sfdx-cli 7.4.0 (core)

sfdx plugins
no plugins installed

It seems like I'm on the right version, but when I run sfdx force:mdapi:convert -r src -d force-app, I still get the following result:
ERROR running force:mdapi:convert: An error was encountered processing path: ...\src\lwc\COMPONENTNAME\COMPONENTNAME.html

I can't really share my component, but perhaps we can both try with one of the sample components and see whether its caused by something in my local setup or something in my component?

@koenwesselman - If you have source the reproduces the error that you can share I'd be happy to track down the problem. You can also try appending --dev-debug when running the command and maybe that will provide some helpful info.

Hi @shetzel , I'd prefer not to share the actual source if possible - it's something I'm working on for a client. Hopefully the debug info is helpful?: https://pastebin.com/QUfz5ijh

From your debug info I saw that you were on a Windows OS and I was able to reproduce it on Windows. This is an OS specific file path separator issue. I'll fix it and put it in the next patch (not tomorrow's patch but the following Thursday). Thanks for the debug info and sorry about the inconvenience.

As a workaround you can try using the force:source:retrieve command, which converts the source for you behind the scenes. I don't believe it has this problem on Windows.

@shetzel , that's great - thanks very much! The retrieve command does indeed work fine, and converting FROM source to metadata api format works fine as well. :-)

Actually this was not a Windows path issue; the fix was in the next major release but was not merged to the patch release branch. You should see this working in 45.13.0 of salesforcedx, which will be available next week Thursday, 5/2. Thanks for your patience!

Hi @shetzel,

this is not fixed I'm on 45.13.0 in Mac and still not working:

$ sfdx force:mdapi:convert -r ../src -d force-app
ERROR running force:mdapi:convert: An error was encountered processing path: ../src/lwc/myLWComponent/myLWComponent.html

Thnaks in advance!!!

@shetzel , this isn't working for me yet either I'm afraid! :-( I'm on version 7.5.0-e6ca93eee8. Here's a new debug info link: https://pastebin.com/i40Y5bUM

Hi @koenwesselman,
update your cli to 7.6.0-28071a499b, this worked for me.
Best regards

I might be missing something, but I'm on the latest version as far as I know:
sfdx-cli: Updating CLI... already on latest version: 7.5.0-e6ca93eee8

Could be there's separate version numbering for Windows & Mac? :-)

@koenwesselman I don't know but in Mac OS and int https://www.npmjs.com/package/sfdx-cli figures 7.6.0

getting the same issue even with it on the latest version.

sfdx-cli: Updating CLI... already on latest version: 7.5.0-e6ca93eee8

I was able to update to 7.8.1-8f830784cc this morning, in which the issue seems to be fixed. :-) Thanks @shetzel !

@koenwesselman @jtomtran

Yup, I can confirm that 7.8.1-8f830784cc has the fix. Was getting it today until I just updated.

@shetzel I still have the issue but with Aura folder.

SFDX CLI version -

$ sfdx --version
sfdx-cli/7.8.1-8f830784cc win32-x64 node-v10.15.3

Receiving error on aura
$ sfdx force:mdapi:convert --rootdir ./mdapipkg -d force-app
WARNING: apiVersion configuration overridden at "45.0"
ERROR running force:mdapi:convert: An error was encountered processing path: \SampleProject\mdapipkg\unpackaged\aura

Anything that I am doing wrong?

@bugude - Looks like you're doing nothing wrong. Would you mind opening a new issue with the details from sfdx plugins --core and running the command again appending --dev-debug? The stack trace it provides is very helpful. Thanks!

looks like the bug has returned?

C:\Users\mgarfinkel\Documents\Salesforce> sfdx force:mdapi:convert -r .\unpackaged
ERROR running force:mdapi:convert:  An error was encountered processing path: C:\Users\mgarfinkel\Documents\Salesforce\unpackaged\lwc\applicationButton\UWApproval.js
PS C:\Users\mgarfinkel\Documents\Salesforce> sfdx update

I can still reproduce the error with sfdx-cli/7.8.1-8f830784cc darwin-x64 node-v10.15.3 ...

--dev-debug?

I just ran into this yesterday as well with an LWC that has an extra js file as part of a service component. @tnoonan-salesforce a simple repro might be to use the lwc-recipes repo here: https://github.com/trailheadapps/lwc-recipes/ Specifically, https://github.com/trailheadapps/lwc-recipes/tree/master/force-app/main/default/lwc/libsD3

The error I see is with processing the "extra" javascript file (in the example above it would be data.js). The error comes from dist/lib/source/mdapiConvertApi.js:277 during file walking in convertSource() so it's probably in _processPath().

OS: Mac
CLI: 7.14.0 - all core plugins

--dev-debug?

attached to W-6325878

getting the same error if there is an extra js file (utility.js) for the component. sfdx-cli 7.36.0 (core).

ERROR running force:mdapi:convert: An error was encountered processing path: /Users/*/SFDX/tempCore/mdapipkg/unpackaged/lwc/baseButtonComponent/baseButtonComponentUtils.js

This was fixed in 46.9.0.

Is there a workaround ?

I am seeing same error on pre-release for force:mdapi:retrieve

An error was encountered during conflict detection. ERROR running force:mdapi:convert:

An error was encountered processing path: /var/folders/xb/h6kpy82n46lc1whxr_xdg4kw0000gn/T/.sfdx/tools/conflicts/***/unpackaged/classes/ABC.cls

sfdx version: sfdx-cli/7.74.1-32db2396ed
salesforcedx 50.1.1 (pre-release)

OS: Any

I am also getting an error like @murthytumuluri04 mentioned.

ERROR running force:mdapi:convert: An error was encountered processing path: /var/folders/82/hz_n99mx1hvb4p2lx80n33gc0000gr/T/.sfdx/tools/conflicts/dev/unpackaged/classes/InquiryContactTriggerHandler.cls

I just upgraded to the latest CLI to fix another error.
OS:Mac
sfdx-cli/7.77.0-112dd7d412
salesforcedx 50.2.0 (core)

Has there been an update/workaround/what have you regarding this? I am running into the issue, though not sure the update to OS X was the cause, and cannot pull down updates to my system as I need.

sfdx force:mdapi:convert --rootdir /var/folders/cg/5qy1ftb57912tlxs0wbvzmv40000gn/T/.sfdx/tools/conflicts/***/unpackaged --outputdir /var/folders/cg/5qy1ftb57912tlxs0wbvzmv40000gn/T/.sfdx/tools/conflicts/***/converted

ERROR running force:mdapi:convert:  An error was encountered processing path: /var/folders/cg/5qy1ftb57912tlxs0wbvzmv40000gn/T/.sfdx/tools/conflicts/***/unpackaged/aura/AURA_COMPONENT/HELPER.js

sfdx force:mdapi:convert --rootdir /var/folders/cg/5qy1ftb57912tlxs0wbvzmv40000gn/T/.sfdx/tools/conflicts/***/unpackaged --outputdir /var/folders/cg/5qy1ftb57912tlxs0wbvzmv40000gn/T/.sfdx/tools/conflicts/***/converted
 ended with exit code 1

ERROR running force:mdapi:convert:  An error was encountered processing path: /var/folders/cg/5qy1ftb57912tlxs0wbvzmv40000gn/T/.sfdx/tools/conflicts/***/unpackaged/aura/AURA_COMPONENT/HELPER.js
Was this page helpful?
0 / 5 - 0 ratings