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

ERROR running force:source:retrieve: Cannot read property 'getWorkspaceElements' of undefined #78

Closed
smukov opened this issue Apr 12, 2019 · 32 comments
Labels
bug Issue or pull request that identifies or fixes a bug owned by another team The Salesforce CLI team does not own this work but will pass on the information to the correct team.

Comments

@smukov
Copy link

smukov commented Apr 12, 2019

Summary

Created a project with manifest and tried to retrieve Wave (Einstein Analytics) components in order to setup source control and CI/CD with them, however, I'm receiving an error in the output.

I am using the sample Developer Edition org provided in Trailhead, so the issue should be easy to reproduce.

Steps To Reproduce:

  1. Create a new Developer Edition org with Einstein Analytics enabled - https://developer.salesforce.com/promotions/orgs/analytics-de
  2. SFDX: Create Project with Manifest
  3. SFDX: Authorize an Org from step 1.
  4. Change the manifest/package.xml content with below
  5. Right click on package.xml and execute SFDX: Retrieve Source in Manifest from Org
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>WaveApplication</name>
    </types>
    <types>
        <members>*</members>
        <name>WaveDashboard</name>
    </types>
    <types>
        <members>*</members>
        <name>WaveDataflow</name>
    </types>
    <types>
        <members>*</members>
        <name>WaveDataset</name>
    </types>
    <types>
        <members>*</members>
        <name>WaveLens</name>
    </types>
    <types>
        <members>*</members>
        <name>WaveRecipe</name>
    </types>
    <types>
        <members>*</members>
        <name>WaveXmd</name>
    </types>
    <types>
        <members>*</members>
        <name>WaveTemplateBundle</name>
    </types>
    <version>45.0</version>
</Package>

Expected result

All Wave* components from the org should have been retrieved, and the command should exit with code 0 (i.e. without any errors).

Actual result

Some (or all? Not sure how to verify.) wave components get retrieved into force-app/main/default/wave and force-app/main/default/waveTemplates folders, the command exits with code 1 and the below error is reported in the output:

14:50:36.562 sfdx force:source:retrieve --manifest f:\SF\test\manifest\package.xml
ERROR running force:source:retrieve:  Cannot read property 'getWorkspaceElements' of undefined
14:50:50.842 sfdx force:source:retrieve --manifest f:\SF\test\manifest\package.xml ended with exit code 1

VS Code Version:

Version: 1.33.0 (system setup)
Commit: 0dd516dd412d42323fc3464531b1c715d51c4c1a
Date: 2019-04-04T15:14:28.026Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17763

SFDX CLI Version:

bash-4.3$ sfdx -v
sfdx-cli/7.3.0-94ecf2d5ee win32-x64 node-v10.15.3

OS and version:

Microsoft Windows 10 Pro 10.0.17763

@ntotten ntotten transferred this issue from forcedotcom/salesforcedx-vscode Apr 12, 2019
@reidaelliott
Copy link

Could you narrow down the package.xml to determine which metadata type is causing the problem. We've done a lot with WaveTemplateBundle. I'm guessing one of the other types is causing this.

@smukov
Copy link
Author

smukov commented Apr 12, 2019

Good thinking @reidaelliott. However, it turns out that WaveTemplateBundle is actually causing the issue.

If I comment out WaveTemplateBundle and leave everything else, the retrieve passes without an error. Also, If I comment out everything else and just leave WaveTemplateBundle in the package.xml, I get the same error as originally reported.

The interesting thing is that it still manages to retrieve metadata into the waveTemplates folder, but I'm unsure if retrieval is partial or complete.

Here's the folder structure in VS Code if it's gonna be of any help:

image

@reidaelliott
Copy link

I have reproduced the problem as well. Will report back when we have a solution. Thanks

@clairebianchi clairebianchi added bug Issue or pull request that identifies or fixes a bug owned by another team The Salesforce CLI team does not own this work but will pass on the information to the correct team. labels Apr 23, 2019
@reidaelliott
Copy link

Fix has been put in place and I believe it will roll out this week. thanks for making us aware of this.

@tony-tawk-ei
Copy link

tony-tawk-ei commented Jun 28, 2019

Hello , I am having the Same issue but for me it is reproduced for Reports and Dashboards .

ERROR running force:source:retrieve: Cannot read property 'getWorkspaceElements' of undefined
12:25:55.340 sfdx force:source:retrieve --manifest

@reidaelliott
Copy link

@tony-tawk-ei the fix that was put in was specific for WaveTemplateBundle and the retrieve command. It sounds like this is happening for a different metadata type? can you confirm it is not WaveTemplateBundle?

@tony-tawk-ei
Copy link

tony-tawk-ei commented Jun 28, 2019 via email

@benmcderm
Copy link

@reidaelliott I'm having the same issue with my package.xml:

ERROR running force:source:retrieve: Cannot read property 'getWorkspaceElements' of undefined

I added items back one at a time and found the culprit:
<types>
<members>*</members>
<name>StaticResource</name>
</types>

Did something change with StaticResource? I haven't had issues with this package.xml until today.

@reidaelliott
Copy link

I ran it using the latest cli installer (sfdx-cli/7.8.1-8f830784cc darwin-x64 node-v10.15.3) against my local server:
sfdx force:source:retrieve -x package.xml
sfdx force:source:retrieve -m StaticResource
Both worked. Maybe you are on a different version or there is something about a static resource in your org causing problems?

@kaushr
Copy link

kaushr commented Aug 31, 2019

@reidaelliott I get the same error with sfdx-cli/7.22.0-de5c6ecff8 darwin-x64 node-v10.15.3

sfdx force:source:retrieve -x "/Users/kaush/Workspace/EA Templates/EAApp/manifest/package.xml"
ERROR running force:source:retrieve: Cannot read property 'getWorkspaceElements' of undefined
MacBook-Pro-38:EAApp kaush$ sfdx -v
sfdx-cli/7.22.0-de5c6ecff8 darwin-x64 node-v10.15.3

Only happens when I add WaveTemplateBundle to the package.xml

@reidaelliott
Copy link

I saw this note : uninstalled SFDX CLI and reinstalled it and retrieve started working. Before I uninstalled it, I had @salesforce/analytics in the plugins along with analytics. After reinstalling I now have just analytics. I suspect @salesforce/analytics was an old plugin maybe?
"

Some people have had to uninstall and reinstall sfdx to force update the version. @salesforce/analytics is a separate plugin for commands to use against Einstein analytics projects.

@reidaelliott
Copy link

someone else just hit this too and running 'sfdx:plugins update' should get everything working too. We also just released a new version 0.8.0 of @salesforce/analytics with some new features

@hagai-shatz
Copy link

I'm getting the same error using sfdx-cli v7.22.0 and analytics plugin v0.8.0

@reidaelliott
Copy link

interesting, and this is for a wavetemplatebundle metadata type? This was fixed in the core sfdx-cli has nothing to do with the analytics plugin, but seems like your on the latest versions of both.

@hagai-shatz
Copy link

Yes, taking part in analytics workshop today and updated/installed everything.
Terminal command and output:

14:43:13.800 sfdx force:source:retrieve -m WaveTemplateBundle:My_Exploration
ERROR running force:source:retrieve:  Cannot read property 'getWorkspaceElements' of undefined
14:43:25.198 sfdx force:source:retrieve -m WaveTemplateBundle:My_Exploration ended with exit code 1

@reidaelliott
Copy link

I'd like to get a copy of this metadata to see if I can reproduce. Is it easily available? What if you run with just sfdx force:source:retrieve -m WaveTemplateBundle

@hagai-shatz
Copy link

It is on an analytics playground org, I can send you the login in private.
Same error when executing sfdx force:source:retrieve -m WaveTemplateBundle

@reidaelliott
Copy link

Thanks. are you currently in the class with Skip Sauls?

@hagai-shatz
Copy link

Yes, I am.

@reidaelliott
Copy link

I think he hit the same problem and somehow was able to get around it, check with him. He can get me the reproducer too if necessary

@hagai-shatz
Copy link

Talking to Skip, I get the same message below every time I run sfdx plugins:update

sfdx plugins:update
warning "@salesforce/analytics > @oclif/[email protected]" has unmet peer dependency "@oclif/plugin-help@^2".
sfdx-cli: Updating plugins... done

@reidaelliott
Copy link

thanks. we'll get that updated should just be a warning. and also reproduced the getWorkspaceElements error so will look into it. It seems the retrieve does work regardless of this error so hopefully not a blocker.

@hagai-shatz
Copy link

We use Illuminated Cloud 2 plugin for IntelliJ IDEA, not Visual Code, and the error is failing the process in our case.
No rush, we just exploring the options at the moment. Thanks.

@reidaelliott
Copy link

fix was made today for sfdx force:source:retrieve of waveTemplateBundles - it should roll out tomorrow

@hagai-shatz
Copy link

Working with sfdx-cli 7.23.1

@santosvels
Copy link

Not working on sfdx-cli/7.25.3-16d54c01ee win32-x64 node-v10.15.3

11:42:48.313 sfdx force:source:retrieve -m Territory2:RSS_Territory_2020_UAT.AM_A_G_APAC_ANZ_CORE_3 ERROR running force:source:retrieve: Cannot read property 'getWorkspaceElements' of undefined 11:43:00.973 sfdx force:source:retrieve -m Territory2:RSS_Territory_2020_UAT.AM_A_G_APAC_ANZ_CORE_3 ended with exit code 1

Just tried this morning although the metadata seems be retrieved nonetheless

@AQTectonic
Copy link

I am also getting the same error while running
sfdx force:source:retrieve -x Package.xml

@reidaelliott
Copy link

It seems like 'getWorkspaceElements' error message can occur with different metadata types. This thread and what I've fixed is only related to WaveTemplateBundles. That should be fixed. It might be most effective to start a new thread for issues with Territory2 . @AQTectonic I am guessing the members in your package.xml are something besides WaveTemplateBundles?

@geraemartinez
Copy link

geraemartinez commented Oct 1, 2019

if you have this in your package.xml it does n't work

<types>
        <members>*</members>
        <name>ApexTestSuite</name>
</types>

but it was working...

@clairebianchi
Copy link
Collaborator

The fix was made for WaveTemplateBundles. If you are still experiencing issues please create a new issue

@abhinavguptas
Copy link

Getting the same error all of sudden for AuraDefinitionBundle

<types> <members>*</members> <name>AuraDefinitionBundle</name> </types>

@shahwazk58
Copy link

ERROR running force:source:retrieve: path must not be empty

please help thanks in advance

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 owned by another team The Salesforce CLI team does not own this work but will pass on the information to the correct team.
Projects
None yet
Development

No branches or pull requests