Skip to content

force:source:push has char limit on file path which causes errors #582

Closed

Description

@gmpmovies

Summary

While trying to push the source code of a Wave Template to a scratch org, I hit the following error: Expected template metadata file [template-info.json] located in path [waveTemplates/Halosight/].. However, the file in question did in fact exist within the specified path and I had no idea why sfdx was unable to locate the file within the path. After a fair amount of troubleshooting I found out that for some reason there is some type of char limit on the file path of the working directory, and if the path is too long, certain elements (i.e. the template-info.json file) will not be located. My original file path was /Users/halosight/Desktop/Halosight/Salesforce OPs/EinsteinApps/halosighteinsteinapp/force-app/main/default/waveTemplates/Halosight. I then shortened the file path by moving the project to my desktop: /Users/halosight/Desktop/halosighteinsteinapp/force-app/main/default/waveTemplates/Halosight and lo and behold the push went through successfully. I replicated this several times to ensure that this was an issue with the length of the working directory path and received the same results every time.

Steps To Reproduce:

  1. Push a Wave Template from the source code to an org.
  2. Make sure your working directory path is really long.
  3. Push will fail. Now shorten the path and it will succeed.

Expected result

Push should succeed regardless of path length.

Actual result

Push fails for some reason if path is too long.

Additional information

SFDX CLI Version: sfdx-cli/7.72.0-697e9faee2 darwin-x64 node-v12.18.3

SFDX plugin Version:

@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.9.0 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/analytics 0.22.0
@salesforce/lwc-dev-server 2.5.1
├─ @oclif/plugin-update 1.3.10
└─ @oclif/plugin-help 2.2.1
@salesforce/sfdx-trust 3.2.1 (core)
analytics 1.12.0 (core)
config 1.1.6 (core)
generator 1.1.3 (core)
salesforcedx 49.8.0
├─ @salesforce/sfdx-plugin-lwc-test 0.1.7
├─ custom-metadata 1.0.8
├─ templates 49.4.4
└─ salesforce-alm 49.8.0
sfdx-cli 7.72.0 (core)

OS and version: Mac OS Catalina 10.15.6

Activity

  1. added
    investigating
    on Nov 13, 2020
  2. added
    bug
    on Nov 13, 2020
  3. mdonnalley commented on Nov 30, 2020

    @mdonnalley
    Contributor

    @gmpmovies I was unable to reproduce the issue when the file path to the wave template was 152 characters long (the path you referenced was 130 characters long)

    Are you still able to reproduce the issue with the latest cli ([email protected] and [email protected])? If so, can you provide a sample project that reliably recreates the issue?

  4. added
    more information required
    and removed
    investigating
    bug
    on Nov 30, 2020
  5. no-response commented on Dec 7, 2020

    @no-response

    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.

  6. jandolina commented on Dec 14, 2020

    @jandolina

    I am still seeing this issue. When a user runs my plugin with -h, it shows the help messages and exits with an error before any code runs in the 'run' function. Is there any more info on this bug?

  7. gmpmovies commented on Dec 14, 2020

    @gmpmovies
    Author

    Current CLI and Plugin Versions:

    sfdx-cli/7.81.0-7b953c80d1 darwin-x64 node-v12.18.3
    @salesforce/analytics 0.23.0
    @salesforce/lwc-dev-server 2.7.0
    ├─ @oclif/plugin-help 2.2.1
    └─ @oclif/plugin-update 1.3.10
    salesforcedx 50.6.0
    ├─ schema 1.0.1
    ├─ custom-metadata 1.0.10
    ├─ @salesforce/sfdx-plugin-lwc-test 0.1.7
    ├─ templates 50.1.0
    ├─ salesforce-alm 50.6.0
    └─ apex 0.1.4
    

    I attempted this again, and received the same results. I do not believe I can share my exact code example being that it is part of a managed package that we are creating. However, to be clear, this issue occurs when running our CI/CD proccess. I have a bash file that creates a scratch org and then installs the source code of our app. If I run the CI/CD script in a folder that has a long file path with this command sfdx force:source:push -f || printf "${red}\nAn error occured while pushing the source to the org. The script will attempt to continue.\n${normal}", I get this exact error: Expected template metadata file [template-info.json] located in path [waveTemplates/Halosight/].. But when I run the script in a folder with a shorter file path (in my desktop for example), it will run without problems.

  8. removed
    more information required
    on Dec 14, 2020
  9. mshanemc commented on Oct 25, 2021

    @mshanemc
    Contributor

    @gmpmovies are you able to still reproduce this? We don't need your actual metadata, just something that's long enough to fail (it can be just one file of any metadata type that'll cause the error).

    And have you only ever caused it with waveTemplates?

  10. added
    more information required
    on Oct 25, 2021
  11. no-response commented on Nov 1, 2021

    @no-response

    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.

  12. seamusocionnaigh commented on Mar 9, 2022

    @seamusocionnaigh

    Hi @mshanemc - I'm encountering this error now, using version: sfdx-cli/7.141.1 win32-x64 node-v16.14.0
    The work-around by @gmpmovies didn't work for me (I moved my project to the C: drive)

    The template-info is observed in the logs:

    {"name":"sfdx","hostname":"jkenny-ltw7","pid":15128,"log":"SourcePathStatusManager","level":20,"deferContentHash":false,"sourcePath":"C:\\ValueAnalytics\\force-app\\main\\default\\waveTemplates\\ValueAnalytics\\template-info.json","size":9048,"modifiedTime":1646763999711,"changeTime":1646763999711,"contentHash":"68fb43d47d60e1238c53c6bd9e5a7f88cc31108c","state":"n","package":"force-app","metadataType":"WaveTemplateBundle","msg":"","time":"2022-03-09T14:03:37.133Z","v":0}

    But shortly after there's the log entry:

    {"name":"sfdx","hostname":"jkenny-ltw7","pid":15128,"log":"SourcePushCommand","level":30,"msg":"[\n {\n error: 'Expected template metadata file [template-info.json] located in path [waveTemplates/ValueAnalytics/].',\n type: 'WaveTemplateBundle',\n problemType: 'Error',\n height: 1\n }\n]","time":"2022-03-09T14:03:37.316Z","v":0}

    Any help or advice it appreciated!

  13. reidaelliott commented on Mar 14, 2022

    @reidaelliott

    @seamusocionnaigh - any chance you could provide a simple workspace that reproduces this problem?

  14. gmpmovies commented on Mar 16, 2022

    @gmpmovies
    Author

    @seamusocionnaigh We just experienced the error again on a different machine. Moving the project to the Root folder also didn't work, but moving the project to the desktop suddenly made it work again. I really have no idea what causes this issue, but for some reason, moving the directory around to the desktop has always fixed it.

  15. removed
    more information required
    on Mar 16, 2022
  16. mshanemc commented on Apr 1, 2022

    @mshanemc
    Contributor

    closed with new commands GA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions