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
491 stars 79 forks source link

SFDX CLI for Windows ERROR: Cannot read property 'fileName' of undefined. for AuraDefinitionBundle #39

Closed GregFinzer closed 1 year ago

GregFinzer commented 5 years ago

Summary

I am receiving the error: ERROR: Cannot read property 'fileName' of undefined.

Steps To Reproduce:

  1. Define this package.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>AuraDefinitionBundle</name>
    </types>
    <version>45.0</version>
</Package>
  1. Run this command: sfdx force:source:retrieve --manifest c:\_hilton\BossReno\manifest\package.xml

Expected result

The source should be retrieved

Actual result

ERROR: Cannot read property 'fileName' of undefined.

Additional information

The development environment is Salesforce Spring 2019

I have posted these questions on the forums: https://salesforce.stackexchange.com/questions/251431/sfdx-error-cannot-read-property-filename-of-undefined/251569#251569

https://developer.salesforce.com/forums/ForumsMain?id=9062I000000QuEcQAK

All other nodes in the package.xml are working fine. Only the AuraDefinitionBundle is not working. I figured this out through process of elimination.

Here is my full package.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexPage</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTestSuite</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTrigger</name>
    </types>
    <types>
        <members>*</members>
        <name>AuraDefinitionBundle</name>
    </types>
    <types>
        <members>*</members>
        <name>StaticResource</name>
    </types>
    <version>45.0</version>
</Package>

SFDX CLI Version(to find the version of the CLI engine run sfdx --version): sfdx-cli/6.54.4-c01dcc69db (windows-x64) node-v8.9.4

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

@salesforce/plugin-generator 1.0.1 (core) @salesforce/sfdx-trust 2.0.1 (core) builtins 1.0.0 (core) salesforcedx 45.3.4

OS and version: Windows 10 Pro

clairebianchi commented 5 years ago

@GregFinzer can you update your Salesforce CLI and retest?

GregFinzer commented 5 years ago

@clairebianchi It looks like there was a problem with the deployment. I did a sfdx update and it gave me the message: Updating CLI... already on latest version: 6.55.1-be0b3dc4c4

I tried doing the same command again in VS Code: sfdx force:source:retrieve --manifest c:\_hilton\BossReno\manifest\package.xml

Here was the response:

ERROR:  Cannot read property 'fileName' of undefined.
08:59:31.188 sfdx force:source:retrieve --manifest c:\_hilton\BossReno\manifest\package.xml ended with exit code 1

Here is the package.xml file that I used:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexPage</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTestSuite</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTrigger</name>
    </types>
    <types>
        <members>*</members>
        <name>StaticResource</name>
    </types>
    <types>
        <members>*</members>
        <name>AuraDefinitionBundle</name>
    </types>    
    <version>45.0</version>
</Package>
shetzel commented 5 years ago

@GregFinzer - If you look at your list of plugins, salesforcedx is at version 45.3.4, which is not the most recent. This means you probably installed a specific version of the salesforcedx plugin at some point. The bug you are hitting was fixed in a later version of the plugin (45.7.1 iirc). You should uninstall that version of the salesforcedx plugin and use the core version that ships with the CLI. Run sfdx plugins:uninstall salesforcedx. If you then run sfdx plugins --core it should display salesforcedx (core). Run the force:source:retrieve command again and you should no longer see that bug.

Ramondi commented 5 years ago

@shetzel I had the exact same issue and running the commands you mentioned I was able to run a retrieve without any problem. Thanks mate!

GregFinzer commented 5 years ago

@shetzel Those steps did not work for me. I also did a full uninstall of salesforce cli, reboot, and then re-install. I also tried the command again:

sfdx plugins:uninstall salesforcedx

Result salesforcedx is not installed

When I do this: sfdx plugins --core

I get this:

@salesforce/plugin-generator 1.0.1 (core)
@salesforce/sfdx-trust 2.0.1 (core)
builtins 1.0.0 (core)
salesforcedx 45.4.1 (core)
shetzel commented 5 years ago

@GregFinzer - Your cli and plugin versions look correct now. Your package.xml also looks good. The next thing to check is if you're locked to an older API version. Look in your sfdx-project.json for sourceApiVersion and if it's set to less than "45.0" then either update it to "45.0" or remove it. Also, append --dev-debug to your sfdx force:source:retrieve command to get lots of debugging output and a stack trace for that error. I'm expecting the stack trace to be identical to a previous bug but if not, maybe we have a new bug on our hands.

Thanks for your patience and all the info in your posts. It really helps when solving problems like this.

GregFinzer commented 5 years ago

@shetzel No problem, I am usually on the other end of the support so I am paying it forward. :smile:

Here is my sfdx-project.json

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    }
  ],
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "45.0"
}

Here is the stack trace. Notice it takes 7 minutes :open_mouth: to get to the error:

C:\_hilton\BossReno>sfdx force:source:retrieve --manifest --dev-debug c:\_hilton\BossReno\manifest\package.xml
  cli starting run +0ms
  cli checking autoupdater +64ms
  rwlockfile read C:\Users\greg.finzer\AppData\Local\sfdx\update.lock +0ms
  cli-engine:hooks init C:\Program Files\Salesforce CLI\client\dist\hooks\plugins\migrate.js +0ms
  sfdx:hook:init:plugins:migrate enter +0ms
  sfdx:plugins:migrate no v5 plugins need migration +0ms
  sfdx:hook:init:plugins:migrate exit +2ms
  cli dispatcher +139ms
  cli-engine:hooks plugins:parse C:\Program Files\Salesforce CLI\client\dist\hooks\plugins\convertFromV5.js +3s
  sfdx:hook:plugins:parse:legacy enter +0ms
  sfdx:hook:plugins:parse:legacy exit +0ms
  cli-engine:hooks plugins:parse C:\Program Files\Salesforce CLI\client\dist\hooks\plugins\convertFromV5.js +14ms
  sfdx:hook:plugins:parse:legacy enter +6ms
  sfdx:hook:plugins:parse:legacy exit +2ms
  cli-engine:hooks prerun C:\Program Files\Salesforce CLI\client\dist\hooks\logAnalytics.js +4ms
  sfdx:hook:analytics enter +0ms
  sfdx:analytics setting up exit handler +0ms
  sfdx:hook:analytics exit +0ms
  cli running flow command { _version: '9.0.7' } +3s
(node:6748) DeprecationWarning: this.out and this.cli is deprecated. Please import the "cli-ux" module directly instead.
(node:6748) DeprecationWarning: cli.color is deprecated. Please use `import color from '@heroku-cli/color'` instead.
  sfdx:core TRACE Setup child 'Org' logger instance +0ms
  sfdx:core TRACE Setup child 'SourceRetrieve' logger instance +13ms
  sfdx:core TRACE Setup child 'SourceUtil' logger instance +8s
  sfdx:SourceUtil INFO Created output directory 'C:\Users\GREG~1.FIN\AppData\Local\Temp\sdx_sourceRetrieve_1551982203207' +0ms
  sfdx:SourceRetrieve INFO Retrieving metadata in manifest 'c:\_hilton\BossReno\manifest\package.xml' from org: 'greg.finzer@dynamit.com.bossdyn' +0ms
  sfdx:core TRACE Setup child 'SourceUtil' logger instance +6m
ERROR:  Cannot read property 'fileName' of undefined.
ERROR:
*** Internal Diagnostic ***

TypeError: Cannot read property 'fileName' of undefined
    at Function.getMetadataFileNameFromBundleFileProperties (C:\Program Files\Salesforce CLI\client\node_modules\salesforce-alm\dist\lib\bundlePathHelper.js:27:48)
    at Function.getPathFromBundleTypeFileProperties (C:\Program Files\Salesforce CLI\client\node_modules\salesforce-alm\dist\lib\bundlePathHelper.js:20:43)
    at AuraDefinitionBundleMetadataType.getDefaultAggregateMetadataPath (C:\Program Files\Salesforce CLI\client\node_modules\salesforce-alm\dist\lib\metadataTypeImpl\bundleMetadataType.js:28:52)
    at SourceWorkspaceAdapter.processMdapiFileProperty (C:\Program Files\Salesforce CLI\client\node_modules\salesforce-alm\dist\lib\sourceWorkspaceAdapter.js:223:55)
    at result.fileProperties.forEach (C:\Program Files\Salesforce CLI\client\node_modules\salesforce-alm\dist\lib\mdapiPullApi.js:132:22)
    at Array.forEach (<anonymous>)
    at MdapiPullApi._syncDownSource (C:\Program Files\Salesforce CLI\client\node_modules\salesforce-alm\dist\lib\mdapiPullApi.js:125:31)
    at SourceRetrieve.<anonymous> (C:\Program Files\Salesforce CLI\client\node_modules\salesforce-alm\dist\lib\source\sourceRetrieve.js:111:56)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Program Files\Salesforce CLI\client\node_modules\salesforce-alm\dist\lib\source\sourceRetrieve.js:10:58)
    at <anonymous>
******

  cli flushing stdout +7m
  sfdx:analytics using C:\Users\greg.finzer\AppData\Local\sfdx\analytics.log for usage error logging +7m
  sfdx:analytics spawned usage "C:\Program Files\Salesforce CLI\client\bin\node.exe C:\Program Files\Salesforce CLI\client\dist\processes\logUsage" +18ms
shetzel commented 5 years ago

I'll reopen this issue until it's resolved. I'm not able to repro this on my windows VM but my file paths are not exactly the same as yours and that is most likely the issue. I'll continue to try to repro but in the meantime I'll give you some things to try.

  1. Unless you're retrieving hundreds of metadata and/or have a very, very large project 7 minutes for a retrieve is ridiculous. Be sure you are excluding C:\Program Files\Salesforce CLI and the sfdx executable from Windows Defender or any other antivirus program. It makes a huge difference in command runtime.
  2. Are you able to use sfdx force:mdapi:retrieve then sfdx force:mdapi:convert as a workaround for retrieving your aura bundles? Although that is essentially what sfdx force:source:retrieve is doing for you it's a slightly different code path when done this way.
  3. So I can reproduce this more exactly, (and if you're comfortable doing so) what is the full path to your aura bundles, including bundle name. E.g., C:\_hilton\BossReno\force-app\main\default\aura\MyAuraBundle1\ If you'd rather not post this info that's ok. I'm mostly looking for special characters or anything else non-standard anywhere in the file path.
  4. If you feel comfortable doing so, please modify C:\Program Files\Salesforce CLI\client\node_modules\salesforce-alm\dist\lib\bundlePathHelper.js line 25 (in the getMetadataFileNameFromBundleFileProperties method) to console log the function args. E.g., console.log('fullName=', fullName); console.log('bundleFileTypeProperties=', bundleFileTypeProperties); Then run your sfdx force:source:retrieve command again and note those logged values.
GregFinzer commented 5 years ago

We have a critical client demo tomorrow that I am preparing for. I will most likely get to this on Monday.

GregFinzer commented 5 years ago

@shetzel

  1. Yes, it is a very large project. I did a file properties and it is around 7000 files. Although I am not sure how many files are just simply files created by sfdx for the typings.
  2. I tried sfdx force:mdapi:retrieve. I waited for about 20 minutes and it never came back.
  3. There is no aura sub folders since I cannot retrieve. I do have an underscore in the folder name at the beginning. The main path is this: C:_hilton\BossReno\force-app\main\default\aura
  4. I modified the JavaScript file and re-ran. Here is the result:

C:_hilton\BossReno>sfdx force:source:retrieve --manifest --dev-debug c:_hilton\BossReno\manifest\package.xml cli starting run +0ms cli checking autoupdater +67ms rwlockfile read C:\Users\greg.finzer\AppData\Local\sfdx\update.lock +0ms cli-engine:hooks init C:\Users\greg.finzer\AppData\Local\sfdx\client\dist\hooks\plugins\migrate.js +0ms sfdx:hook:init:plugins:migrate enter +0ms sfdx:plugins:migrate no v5 plugins need migration +0ms sfdx:hook:init:plugins:migrate exit +0ms cli dispatcher +133ms cli-engine:hooks plugins:parse C:\Users\greg.finzer\AppData\Local\sfdx\client\dist\hooks\plugins\convertFromV5.js +3s sfdx:hook:plugins:parse:legacy enter +0ms sfdx:hook:plugins:parse:legacy exit +0ms cli-engine:hooks plugins:parse C:\Users\greg.finzer\AppData\Local\sfdx\client\dist\hooks\plugins\convertFromV5.js +16ms sfdx:hook:plugins:parse:legacy enter +16ms sfdx:hook:plugins:parse:legacy exit +0ms cli-engine:hooks prerun C:\Users\greg.finzer\AppData\Local\sfdx\client\dist\hooks\logAnalytics.js +4ms sfdx:hook:analytics enter +0ms sfdx:analytics setting up exit handler +0ms sfdx:hook:analytics exit +0ms cli running flow command { _version: '9.0.7' } +3s (node:25512) DeprecationWarning: this.out and this.cli is deprecated. Please import the "cli-ux" module directly instead. (node:25512) DeprecationWarning: cli.color is deprecated. Please use import color from '@heroku-cli/color' instead. sfdx:core TRACE Setup child 'Org' logger instance +0ms sfdx:core TRACE Setup child 'SourceRetrieve' logger instance +0ms sfdx:core TRACE Setup child 'SourceUtil' logger instance +9s sfdx:SourceUtil INFO Created output directory 'C:\Users\GREG~1.FIN\AppData\Local\Temp\sdx_sourceRetrieve_1552394161160' +0ms sfdx:SourceRetrieve INFO Retrieving metadata in manifest 'c:_hilton\BossReno\manifest\package.xml' from org: 'greg.finzer@dynamit.com.bossdyn' +0ms sfdx:core TRACE Setup child 'SourceUtil' logger instance +37s ERROR: Cannot read property 'fileName' of undefined. ERROR: Internal Diagnostic

TypeError: Cannot read property 'fileName' of undefined at Function.getMetadataFileNameFromBundleFileProperties (C:\Users\greg.finzer\AppData\Local\sfdx\client\node_modules\salesforce-alm\dist\lib\bundlePathHelper.js:27:48) at Function.getPathFromBundleTypeFileProperties (C:\Users\greg.finzer\AppData\Local\sfdx\client\node_modules\salesforce-alm\dist\lib\bundlePathHelper.js:20:43) at AuraDefinitionBundleMetadataType.getDefaultAggregateMetadataPath (C:\Users\greg.finzer\AppData\Local\sfdx\client\node_modules\salesforce-alm\dist\lib\metadataTypeImpl\bundleMetadataType.js:28:52) at SourceWorkspaceAdapter.processMdapiFileProperty (C:\Users\greg.finzer\AppData\Local\sfdx\client\node_modules\salesforce-alm\dist\lib\sourceWorkspaceAdapter.js:223:55) at result.fileProperties.forEach (C:\Users\greg.finzer\AppData\Local\sfdx\client\node_modules\salesforce-alm\dist\lib\mdapiPullApi.js:132:22) at Array.forEach () at MdapiPullApi._syncDownSource (C:\Users\greg.finzer\AppData\Local\sfdx\client\node_modules\salesforce-alm\dist\lib\mdapiPullApi.js:125:31) at SourceRetrieve. (C:\Users\greg.finzer\AppData\Local\sfdx\client\node_modules\salesforce-alm\dist\lib\source\sourceRetrieve.js:111:56) at Generator.next () at fulfilled (C:\Users\greg.finzer\AppData\Local\sfdx\client\node_modules\salesforce-alm\dist\lib\source\sourceRetrieve.js:10:58) at


cli flushing stdout +46s sfdx:analytics using C:\Users\greg.finzer\AppData\Local\sfdx\analytics.log for usage error logging +46s sfdx:analytics spawned usage "C:\Users\greg.finzer\AppData\Local\sfdx\client\bin\node.exe C:\Users\greg.finzer\AppData\Local\sfdx\client\dist\processes\logUsage" +16ms

shetzel commented 5 years ago

@GregFinzer - Your last post has a different stack trace that points to different plugin code. It looks like you may have been auto-updated to a more recent version in between the first stack trace and your most recent stack trace. So I don't see the console.log output from the modified js because it didn't use that source when running the command. Next chance you get can you run the command again, get the stack trace, then look at the top file and modify that file in the same place. It should be this file: C:\Users\greg.finzer\AppData\Local\sfdx\client\node_modules\salesforce-alm\dist\lib\bundlePathHelper.js. Add those console logs, re-run the command and send what the values are for fullName and bundleFileTypeProperties. Thanks!

GregFinzer commented 5 years ago

@shetzel the file still had the logging statements even after the update. Here is the method with the modified code:

static getMetadataFileNameFromBundleFileProperties(fullName, bundleFileTypeProperties) { console.log('fullName=', fullName); console.log('bundleFileTypeProperties=', bundleFileTypeProperties); const bundleName = fullName.split(path.sep)[0]; const matchingBundle = bundleFileTypeProperties.find(fileProperty => fileProperty.fullName.split(path.sep)[0] === bundleName); return${path.basename(matchingBundle.fileName)}${MetadataRegistry.getMetadataFileExt()}; }

shetzel commented 5 years ago

@GregFinzer - right but that's the file from the original install. When you update to a newer version of the cli the files are in a different location. You need to modify bundlePathHelper.js in that location because those are the files used when you run the commands after a cli update. Your modified code looks perfect. You just need to make the same modification to C:\Users\greg.finzer\AppData\Local\sfdx\client\node_modules\salesforce-alm\dist\lib\bundlePathHelper.js. After you do that, then run your command from within your project and send the values of fullName and bundleFileTypeProperties.

sfdx force:source:retrieve --manifest c:_hilton\BossReno\manifest\package.xml

no-response[bot] commented 5 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.

GregFinzer commented 5 years ago

That path does not exist on my machine.

rkathir commented 5 years ago

I'm getting this issue in my mac... SFDX is not unable to retrieve the metadata from a developer sandbox.

rkathir commented 5 years ago

Here is my mac version of sfdc..

$ 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.16.0 (core) ├─ force-language-services 45.12.0 (core) └─ salesforce-alm 45.18.0 (core)

sfdx-cli 7.8.1 (core)

rkathir commented 5 years ago

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

rkathir commented 5 years ago

sfdx force:source:retrieve --manifest ./manifest/package.xml ERROR running force:source:retrieve: Cannot read property 'fileName' of undefined

rkathir commented 5 years ago

Please help me fix this issue...

rkathir commented 5 years ago

when I add the console.log in /usr/local/lib/sfdx/node_modules/salesforce-alm/dist/lib/source/bundlePathHelper.js

I see the error log of 515,944 lines...

rkathir commented 5 years ago

Its all because of AuraDefinitionBundle metadata that is causing this error... We have 148 Aura components folder... maybe this tool is not supported to have these many subfolders and components.

clairebianchi commented 5 years ago

@rkathir there is currently a bug in the CLI with subfolders and source:retrieve. We are actively fixing this bug and we should have a fix out in this week's CLI release (updates to the CLI are usually released on Thursdays). Please update at the end of the week and try again. If you are still seeing the error let me know and I will investigate further.

rkathir commented 5 years ago

@clairebianchi Thank you. Please let me know the steps to uninstall and reinstall in MAC..

clairebianchi commented 5 years ago

You should not need to uninstall and reinstall. Instead, you can just update your CLI by running 'sfdx update' The fix for your issues has been pushed to next week because this issue is also affecting a few other commands.

If you still wish to uninstall, here are the instructions: https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_uninstall.htm

rkathir commented 5 years ago

@clairebianchi: Thanks for the update, looking forward to the fix asap next week.

GregFinzer commented 5 years ago

@clairebianchi that is fantastic news. I have been waiting for this fix for five months. Thanks so much!

aljaz823 commented 4 years ago

@clairebianchi Hi, this error doesn't seem to fixed, at least for me. I have the latest version of sfdx:

@oclif/plugin-commands 1.2.3 (core) @oclif/plugin-help 2.2.1 (core) @oclif/plugin-not-found 1.2.3 (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-diff 0.0.2 @salesforce/sfdx-trust 3.0.5 (core) analytics 1.2.1 (core) generator 1.1.1 (core) salesforcedx 47.1.5 (core) ├─ force-language-services 47.5.0 (core) └─ salesforce-alm 47.4.0 (core) sfdx-cli 7.28.7 (core)

This is my package.xml file which fails the retrieve: <?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <types> <members>*</members> <name>AuraDefinitionBundle</name> </types> <version>47.0</version> </Package>

Here's the sfdx-project.json file: { "packageDirectories": [ { "path": "force-app", "default": true } ], "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", "sourceApiVersion": "47.0" }

I get the ERROR running force:source:retrieve: Cannot read property 'fileName' of undefined

This happens when I try to retrieve all of AuraDefinitionBundle with wildcard(*). I can successfully retrieve a single AuraDefinitionBundle (at least the one I tried to).

Also the force:mdapi:retrieve works as expected, but is not the ideal solution for me.

clairebianchi commented 4 years ago

We believe this has been fixed. If you still encounter this issue please open a new issue.

judamarto commented 4 years ago

Hi, I'm having the same issue, trying to retrieve source using package.xml

force:source:retrieve: Cannot read property 'fileName' of undefined and here is my plugins:

PS C:\Users\judam\Documents\salesforce\MyComponents> sfdx plugins --core @oclif/plugin-autocomplete 0.1.5 (core) @oclif/plugin-commands 1.2.3 (core) @oclif/plugin-not-found 1.2.3 (core) @oclif/plugin-plugins 1.7.9 (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.7 (core) analytics 1.7.1 (core) generator 1.1.2 (core) salesforcedx 48.5.1 (core) ├─ @salesforce/sfdx-plugin-lwc-test 0.1.5 (core) ├─ salesforcedx-templates 48.6.0 (core) └─ salesforce-alm 48.7.0 (core)

prem-pal commented 4 years ago

This issue is not yet resolved.

@oclif/plugin-autocomplete 0.1.5 (core) @oclif/plugin-commands 1.2.3 (core) @oclif/plugin-help 2.2.3 (core) @oclif/plugin-not-found 1.2.3 (core) @oclif/plugin-plugins 1.7.9 (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.7 (core) analytics 1.7.1 (core) generator 1.1.2 (core) salesforcedx 48.8.0 (core) ├─ @salesforce/sfdx-plugin-lwc-test 0.1.5 (core) ├─ salesforcedx-templates 48.8.0 (core) └─ salesforce-alm 48.8.0 (core)

sfdx-cli 7.53.0 (core)

sfdx force:source:retrieve -m AuraDefinitionBundle ERROR running force:source:retrieve: Cannot read property 'fileName' of undefined

rogeramitchell commented 4 years ago

Started experiencing this issue this morning @clairebianchi.

Steps to Reproduce

Do any of these:

Error Details ERROR running force:source:retrieve: Cannot read property 'fileName' of undefined

Version Details

macOS 10.15.4
@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.0.1 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.7.10 (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.0.7 (core)
analytics 1.12.0 (core)
generator 1.1.3 (core)
salesforcedx 49.4.1 (core)
├─ salesforcedx-templates 48.32.0 (core)
├─ custom-metadata 1.0.7 (core)
├─ salesforce-alm 49.4.0 (core)
└─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
sfdx-cli 7.68.6 (core)
clairebianchi commented 4 years ago

@rogeramitchell Thank you for reaching out. We are working with the team that owns the LWC metadata types to get this fixed.

jayanthiravindran-capgemini commented 4 years ago

Hi , ERROR running force:source:retrieve: Cannot read property 'fileName' of undefined - > Still the bug exists?

diegohna commented 4 years ago

I have started to have the same issue

here what have i. done and no luck

MBP-de-Diego:Developer - CROSS diego.almeida$ sfdx plugins:uninstall salesforcedxUninstalling salesforcedx... MBP-de-Diego:Developer - CROSS diego.almeida$ sfdx plugins -- core@oclif/plugin-autocomplete 0.1.5 (core) @oclif/plugin-commands 1.3.0 (core) @oclif/plugin-help 3.1.0 (core) @oclif/plugin-not-found 1.2.4 (core) @oclif/plugin-plugins 1.9.0 (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.2.1 (core) analytics 1.12.0 (core) generator 1.1.3 (core) salesforcedx 49.6.1 (core) ├─ salesforcedx-templates 49.2.0 (core) ├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core) ├─ custom-metadata 1.0.8 (core) └─ salesforce-alm 49.6.0 (core) sfdx-cli 7.70.1 (core)

MBP-de-Diego:Developer - CROSS diego.almeida$ sfdx force:source:retrieve --manifest --dev-debug manifest/package.xml

RROR running force:source:retrieve: Cannot read property 'fileName' of undefined Internal Diagnostic

TypeError: Cannot read property 'fileName' of undefined at Function.getMetadataFileNameFromBundleFileProperties (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/lib/source/bundlePathHelper.js:43:48) at Function.getPathFromBundleTypeFileProperties (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/lib/source/bundlePathHelper.js:35:43) at AuraDefinitionBundleMetadataType.getDefaultAggregateMetadataPath (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/lib/source/metadataTypeImpl/bundleMetadataType.js:30:52) at SourceWorkspaceAdapter.processMdapiFileProperty (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/lib/source/sourceWorkspaceAdapter.js:270:59) at /usr/local/lib/sfdx/node_modules/salesforce-alm/dist/lib/source/sourcePullApi.js:165:22 at Array.forEach () at MdapiPullApi._syncDownSource (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/lib/source/sourcePullApi.js:158:31) at SourceRetrieve.retrieveFromManifest (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/lib/source/sourceRetrieve.js:137:56) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async SourceRetrieve.retrieve (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/lib/source/sourceRetrieve.js:65:27) at async SourceRetrieveCommand.execute (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/lib/source/sourceRetrieveCommand.js:31:16) at async SourceRetrieveCommand.execLegacyCommand (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/ToolbeltCommand.js:148:29) at async SourceRetrieveCommand.run (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/commands/force/source/retrieve.js:31:16) at async SourceRetrieveCommand._run (/usr/local/lib/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:93:40) at async Config.runCommand (/usr/local/lib/sfdx/node_modules/@oclif/config/lib/config.js:173:24) at async Main.run (/usr/local/lib/sfdx/node_modules/@oclif/command/lib/main.js:22:9) Outer stack: at Function.wrap (/usr/local/lib/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/core/lib/sfdxError.js:151:27) at SourceRetrieveCommand.catch (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/ToolbeltCommand.js:247:46) at async SourceRetrieveCommand._run (/usr/local/lib/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:97:13) at async Config.runCommand (/usr/local/lib/sfdx/node_modules/@oclif/config/lib/config.js:173:24) at async Main.run (/usr/local/lib/sfdx/node_modules/@oclif/command/lib/main.js:22:9) at async Main._run (/usr/local/lib/sfdx/node_modules/@oclif/command/lib/command.js:43:20) at async Object.run (/usr/local/lib/sfdx/dist/cli.js:32:20)


Code with bug

class BundlePathHelper { static getPathFromBundleTypeFileProperties(fullName, defaultSourceDir, defaultDirName, bundleFileTypeProperties) { const bundleName = fullName.split(path.sep)[0]; const pathToDefaultTypeDirectory = path.join(defaultSourceDir, defaultDirName); const fileName = BundlePathHelper.getMetadataFileNameFromBundleFileProperties(fullName, bundleFileTypeProperties); return path.join(pathToDefaultTypeDirectory, bundleName, fileName); } static getMetadataFileNameFromBundleFileProperties(fullName, bundleFileTypeProperties) { const bundleName = fullName.split(path.sep)[0]; const matchingBundle = bundleFileTypeProperties.find(fileProperty => fileProperty.fullName.split(path.sep)[0] === bundleName); return ${path.basename(matchingBundle.fileName)}${MetadataRegistry.getMetadataFileExt()}; }

kushalbhalodiya commented 3 years ago

I am facing same issue again. I tried updating all to latest version by uninstalling everything and installing again but still same issue. If I remove AuraDefinitionBundle from package.xml it is working fine. I also tried to remove the sourceApiVersion from sfdx-project.json but didn't help. Looks like this issue is not resolved. Can anyone please let me know which is the stable version of CLI for aura development?

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

Version info: @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.0 (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.1 (core) analytics 1.12.1 (core) config 1.1.8 (core) generator 1.1.3 (core) salesforcedx 49.10.0 (core) ├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core) ├─ salesforce-alm 49.11.0 (core) ├─ custom-metadata 1.0.10 (core) ├─ templates 49.4.4 (core) └─ apex 0.0.9 (core) sfdx-cli 7.74.1 (core)

shetzel commented 3 years ago

@kushalbhalodia - the latest CLI version is 7.76.1. The latest salesforcedx plugin version is 50.1.1. You should be able to update to the latest by running sfdx update if you installed the CLI via an installer. If you installed using npm then you need to update with npm.

kushalbhalodiya commented 3 years ago

@kushalbhalodia - the latest CLI version is 7.76.1. The latest salesforcedx plugin version is 50.1.1. You should be able to update to the latest by running sfdx update if you installed the CLI via an installer. If you installed using npm then you need to update with npm.

Thank you @shetzel for quick response. I tried again after updating cli but still facing same error. Does the windows version matter as I am running on "10.0.19042 Build 19042"? Below is the version details of CLI:

@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.1 (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-diff 0.0.6 @salesforce/sfdx-trust 3.4.3 (core) alias 1.1.2 (core) analytics 1.12.1 (core) auth 1.3.0 (core) config 1.1.9 (core) generator 1.1.3 (core) salesforcedx 50.2.0 (core) ├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core) ├─ templates 50.1.0 (core) ├─ salesforce-alm 50.2.0 (core) ├─ custom-metadata 1.0.10 (core) └─ apex 0.1.1 (core) sfdx-cli 7.77.0 (core)

Error: Starting SFDX: Retrieve Source from Org

10:16:36.136 sfdx force:source:retrieve --manifest c:\Users\kbhalodiya\Desktop\VSCODE\DEV\manifest\package.xml ERROR running force:source:retrieve: Cannot read property 'fileName' of undefined 10:17:06.62 sfdx force:source:retrieve --manifest c:\Users\kbhalodiya\Desktop\VSCODE\DEV\manifest\package.xml ended with exit code 1

Any help would be much appreciated as I am unable to update Aura components from vscode.

IVerkhosh commented 3 years ago

is anybody looking into this issue? When I try to deploy anything, I am getting Starting SFDX: Deploy Source to Org - Cannot read property 'id' of undefined. The same when I am trying to retrieve with SFDX: Retrieve Source in Manifest from Org

mshanemc commented 1 year ago

I'm going to close this issue. None of the code from when this was filed is still in use or exists.

@IVerkhosh if you've got a reproduction on current versions of the CLI, then please open a new issue with all the relevant so we can get that fixed.