Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sfdx force:source:deploy --manifest ERROR: Cannot read property 'getMetadataName' of undefined. #16

Closed
JimBTek opened this issue Aug 24, 2018 · 5 comments
Labels
bug Issue or pull request that identifies or fixes a bug tracked elsewhere The work is being tracked internally by Salesforce

Comments

@JimBTek
Copy link

JimBTek commented Aug 24, 2018

Summary

It seems like if your pacakge.xml has any metadata components listed that do not exist in your force-app, that it fails.

Steps To Reproduce:

  1. sfdx force:source:retrieve -- manifest in VS Code pull source from Org with a Package.xml file
  2. change orgs in VS Code to a new sandbox
  3. sfdx force:source:deploy --manifest /manifest/package.xml with the VS code right click

get the error ERROR: Cannot read property 'getMetadataName' of undefined.

Expected result

unless you have undeployable metadata components in your package.xml, you should be able to use the same package.xml to both source:retrieve and source:deploy

Actual result

If mtetadata defined in your package.xml returns no files, then that folder is not created in force-app. then when you try to deploy you get ERROR: Cannot read property 'getMetadataName' of undefined.

Additional information

VSCode output window:

Starting SFDX: Deploy Source to Org

sfdx force:source:deploy --manifest /project/manifest/package.xml
WARNING: apiVersion configuration overridden at 43.0
ERROR:  Cannot read property 'getMetadataName' of undefined.
sfdx force:source:deploy --manifest /project/manifest/package.xml ended with exit code 1

VS Code Version:
OSX Version 1.26.1 (1.26.1)

SFDX CLI Version:
sfdx-cli/6.29.0 (darwin-x64) node-v8.11.2

OS and version:
OSX 10.12.6

@JimBTek
Copy link
Author

JimBTek commented Aug 27, 2018

I'll just add that perhaps the easiest and best solution is to just add to that Warning, some help message like "Your source is missing components referenced in your Package.xml file. Try using force:source:deploy /{file directory} like force:source:deploy /force-app" instead.

I think a more important issue is the sfdx does not intelligently handle things like flows well, whereas tools like force-cli and solenopsis determine how to only deploy missing / inactive flows.

@st-sfdc
Copy link

st-sfdc commented Jan 9, 2019

Why is there different behaviour when retrieving vs. deploying from the same package.xml? My (maybe naive) expectation is that if I have a component in my package.xml

  1. it is pulled on retrieve (unless not existing, which is a package.xml error)
  2. It is getting deployed on source:deploy (unless has a deployment problem)
    The behaviour should be consistent per metadata component imho

@ntotten ntotten transferred this issue from forcedotcom/salesforcedx-vscode Jan 9, 2019
@ntotten ntotten transferred this issue from forcedotcom/sfdx-core Jan 9, 2019
@clairebianchi clairebianchi transferred this issue from forcedotcom/cli-packages Jan 29, 2019
@clairebianchi clairebianchi added bug Issue or pull request that identifies or fixes a bug tracked elsewhere The work is being tracked internally by Salesforce labels Jan 29, 2019
@clairebianchi
Copy link
Collaborator

@JimBTek Thank you for the feedback, we are tracking this bug in our internal system. Our internal work item is W-5749751, and I have it on our backlog for the summer release. I'll leave this ticket open till we fix it.

@renatoliveira
Copy link

Interesting thing I found: a typo in your deploy command can produce this error too.

sfdx force:source:deploy -m LightningtComponentBundle:myComponent

Note the extra "T" before "Component". This productes the same error described in the original post. Fixing the metadata name makes the command work.

Just commenting in case someone else has this same issue because of a silly typo. :)

@uip-robot-zz
Copy link

This issue has been linked to a new work item: W-9297987

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug tracked elsewhere The work is being tracked internally by Salesforce
Projects
None yet
Development

No branches or pull requests

7 participants