Unable to deploy LWC components after refresh\retrieve | [...] Invalid meta-xml name [...] should end with js-meta.xml

Issue #1876 resolved
Nunzio Capasso created an issue

Hi Scott,

in recent days, we started noticing this really weird behavior but fortunately enough, we are now able to reproduce it.
This seems to appen only when trying to retrieve\refresh a single component but not when retrieving the entire project and only with components that have a CSS file.
Error:

Deployment Failed
            ERROR deploying LightningComponentBundle lwc/adt_header/adt_header.js: Unable to build Lightning Component source for markup://c:adt_header: Invalid meta-xml name: lwc/adt_header/adt_header.css-meta.xml, should end with js-meta.xml

Screenshot: https://kutt.it/k25j6l

The attached log has been obtained with those IC debug options:

#com.illuminatedcloud.intellij.builder.IlluminatedCloudSaveAllAction
#com.illuminatedcloud.intellij.builder.ForceComBuilder
#com.illuminatedcloud.intellij.builder.ForceComBuilderUtil
#com.illuminatedcloud.intellij.builder.ForceComMetadataApiDeployer
#com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataDeployer
#com.illuminatedcloud.intellij.builder.ForceComSfdxDeployer
#com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataUtil
#com.illuminatedcloud.intellij.builder.ForceComToolingApiDeployer
#com.illuminatedcloud.intellij.builder.ForceComBuildFailureAnnotator
#com.illuminatedcloud.util.VariableLengthPollingInterval

#com.illuminatedcloud.intellij.builder.RefreshAction
#com.illuminatedcloud.intellij.builder.RetrieveAction
#com.illuminatedcloud.intellij.builder.ForceComBuilder
#com.illuminatedcloud.intellij.builder.ForceComBuilderUtil
#com.illuminatedcloud.intellij.builder.ForceComMetadataRetriever
#com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataRetriever
#com.illuminatedcloud.intellij.builder.ForceComSfdxRetriever
#com.illuminatedcloud.intellij.builder.ForceComSfdxMetadataUtil
#com.illuminatedcloud.intellij.util.IlluminatedCloudDiffUtil
#com.illuminatedcloud.util.VariableLengthPollingInterval

Currently using the latest version of IntelliJ, IC and SFDX cli.
Thanks,
NC.

Comments (21)

  1. Scott Wells repo owner

    Hi. Can you please make sure that your Salesforce CLI is 100% up-to-date? And if it is, please completely uninstall and reinstall it. I believe this is an issue in the CLI that was fixed a bit back. If you can still reproduce it on a 100% fresh install of the latest build, please let me know.

  2. Scott Wells repo owner

    As a SUPER-quick follow-up, I actually think you may be able to do this on a fresh reinstall as I heard about this from one other person recently who saw this in exactly one project. Let's get to a fresh reinstall of the latest version just to be 100% sure, though, and then we'll debug it further from there.

  3. Nunzio Capasso reporter

    Hi,
    just did a fresh install of the CLI and created a fresh project but unfortunately the issue still there.

    I also tried the same exact project with VScode and SFDX plugins but I was not able to reproduce the problem.

  4. Scott Wells repo owner

    Thanks, Nunzio. Here's an interesting extract from the log:

    2021-05-03 10:09:35,126 [  78254]  DEBUG - er.ForceComMetadataApiDeployer - Using the metadata API to deploy the following files for module 0-KMdev: { standardCommunityNews }. 
    2021-05-03 10:09:35,126 [  78254]  DEBUG - er.ForceComMetadataApiDeployer - Creating a deployment archive. 
    2021-05-03 10:09:35,126 [  78254]  DEBUG - er.ForceComMetadataApiDeployer -   Processing file standardCommunityNews 
    2021-05-03 10:09:35,127 [  78255]  DEBUG - er.ForceComMetadataApiDeployer -   Adding files to the archive: 
    2021-05-03 10:09:35,128 [  78256]  DEBUG - er.ForceComMetadataApiDeployer -     'standardCommunityNews.js' as 'lwc/standardCommunityNews/standardCommunityNews.js' 
    2021-05-03 10:09:35,130 [  78258]  DEBUG - er.ForceComMetadataApiDeployer -     'standardCommunityNews.css' as 'lwc/standardCommunityNews/standardCommunityNews.css' 
    2021-05-03 10:09:35,130 [  78258]  DEBUG - er.ForceComMetadataApiDeployer -     'standardCommunityNews.html' as 'lwc/standardCommunityNews/standardCommunityNews.html' 
    2021-05-03 10:09:35,131 [  78259]  DEBUG - er.ForceComMetadataApiDeployer -     'standardCommunityNews.css-meta.xml' as 'lwc/standardCommunityNews/standardCommunityNews.css-meta.xml' 
    

    Can you confirm that the component's meta.xml file is based on the CSS file and not the JS file? If so, that looks wrong to me. I'm not sure why other tools would even be able to deploy that. Does renaming standardCommunityNews.css-meta.xml to standardCommunityNews.js-meta.xml resolve the issue?

  5. Nunzio Capasso reporter

    Hi Scott,

    I am sorry, I probably could have explained it a little bit better…
    Basically, the VScode is able to deploy that component because it never generates the file named standardCommunityNews.css-meta.xml but correctly generates the standardCommunityNews.js-meta.xml.

    Renaming standardCommunityNews.css-meta.xml to standardCommunityNews.js-meta.xml resolve the issue.

  6. Scott Wells repo owner

    Ah, okay. Do you remember how you created that component? Was it created initially as a Style component vs. a UI or Service component? If so, that would explain it. However, if you're getting a .css-meta.xml file when creating a UI or Service component, please let me know as that would represent a bug.

  7. Scott Wells repo owner

    I'm going to resolve this since renaming the meta.xml file addresses the issue. If you find that you can get into this state outside of creating a style component, please feel free to reopen with steps to reproduce.

  8. Nunzio Capasso reporter

    Ah, okay. Do you remember how you created that component? Was it created initially as a Style component vs. a UI or Service component? If so, that would explain it. However, if you're getting a .css-meta.xml file when creating a UI or Service component, please let me know as that would represent a bug.

    Yes, it was probably created as UI component. I also tried to create a new LWC as Style and as a Service component and got the correct meta.xml file created (js-meta.xml) . So the problem seems to be still relegated only to freshly retrieved\refreshed UI component that has CSS file.

    I'm going to resolve this since renaming the meta.xml file addresses the issue. If you find that you can get into this state outside of creating a style component, please feel free to reopen with steps to reproduce.

    Thanks a lot!

  9. Scott Wells repo owner

    Sorry, that statement confuses me. If it was created as a UI component it should have *.js-meta.xml. The only situation in which it should have *.css-meta.xml is if it was created as a Style component. Are you saying that creation of a UI component has resulted in a meta.xml file associated with the CSS file? If so, that's definitely a bug. Or did you mean that it was probably created as a Style component? Just trying to figure out if there's something to fix here or not...

  10. Nunzio Capasso reporter

    So, when I retrieve from the ORG an LWC component (with a CSS file) that’s never been on my local machine everything is created correctly and I am able to deploy without any problem:

    lwc/vax_InterCompanySupplyTransfer/vax_InterCompanySupplyTransfer.css 
    lwc/vax_InterCompanySupplyTransfer/vax_InterCompanySupplyTransfer.html 
    lwc/vax_InterCompanySupplyTransfer/vax_InterCompanySupplyTransfer.js 
    lwc/vax_InterCompanySupplyTransfer/vax_InterCompanySupplyTransfer.js-meta.xml
    

    When I refresh or retrieve an LWC component that is already present on my local machine:

    • lwc/vax_cvoToCvoSupplyTransfer/vax_cvoToCvoSupplyTransfer.css
    • lwc/vax_cvoToCvoSupplyTransfer/vax_cvoToCvoSupplyTransfer.css-meta.xml
    • lwc/vax_cvoToCvoSupplyTransfer/vax_cvoToCvoSupplyTransfer.html
    • lwc/vax_cvoToCvoSupplyTransfer/vax_cvoToCvoSupplyTransfer.js
    

    As u can see the js-meta.xml got replaced with css-meta.xml , this makes the component undeployable unless u change the name back to js-meta.xml

    The only situation in which it should have *.css-meta.xml is if it was created as a Style component. Are you saying that creation of a UI component has resulted in a meta.xml file associated with the CSS file?

    I did notice that just now that I tried it (unfortunately I never made a style-only LWC) and on creation, it does not generate a *.css-meta.xml but *.js-meta.xml and this is probably correct since it allows me to deploy without any issue but when I try to retrieve\refresh the component it behaves as described above but with a different error:

    Deployment Complete: Deployed 0/1 components to VA_DEV in 4 s 55 ms with status SUCCEEDED_PARTIAL.
    

  11. Scott Wells repo owner
    • changed status to open

    Okay. Let's reopen this and I'll investigate a bit more. Thanks for providing the additional detail!

  12. Scott Wells repo owner

    Okay, I just reproduced this successfully with the following steps:

    1. Create a new UI component with a CSS file in a source format project against a non-scratch org.
    2. If not configured for deploy-on-save, explicitly deploy the new component.
    3. Use Compare with Server on the component's bundle directory.
    4. See that *.css-meta.xml was retrieved vs. *.js-meta.xml which is present locally.

    Time to dig in!

  13. Scott Wells repo owner

    Okay, I've confirmed that it's a CLI bug with force:source:retrieve in a very specific situation:

    https://github.com/forcedotcom/cli/issues/1001

    I'll give them a few to see if they're going to fix it, and if it looks like a fix won't be produced quickly, I'll probably implement a workaround in IC2's CLI-based metadata retriever to detect and fix this behavior itself.

  14. Scott Wells repo owner

    Chatted with one of the CLI team members and this is being tracked via:

    https://github.com/forcedotcom/cli/issues/761

    It has already been fixed in the open source CLI initiative, and the fix will likely only be delivered via that work and not the current CLI. That's probably going to take a few more months.

    As a result, I've implemented a workaround that renames the retrieved file as appropriate when this condition is observed in retrieved metadata. This workaround will be delivered in the next build, likely Thursday morning, but if you'd like to help verify that it does indeed resolve the issue for you, I've attached a build based on 2.1.7.4 with only that workaround integrated.

    You can install this test build by downloading the archive (don't extract it) and installing it using Settings / Preferences > Plugins > Install plugin from disk (under the gear drop-down menu).

    If you do install it, please let me know whether or not it resolves the issue for you.

  15. Nunzio Capasso reporter

    Hi Scott,
    Just tried this new build and I can confirm that it solves the issue! thanks!

  16. Scott Wells repo owner

    Okay, great! Go ahead and sit tight on that build until I push out a new official one, likely tomorrow morning.

  17. Log in to comment