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
493 stars 78 forks source link

Parent directory named 'lwc' outside the app directory causes deploy to fail with cryptic message. #1395

Closed dbreese closed 1 year ago

dbreese commented 2 years ago

Summary

A parent directory named 'lwc' will cause deployments to fail with cryptic error message:

$ pwd 
~/projects/lwc/TestApp

$ sfdx force:source:deploy -p force-app/main/default/lwc
*** Deploying with SOAP API v53.0 ***
Deploy ID: 0Afx000000012nDCAQ
DEPLOY PROGRESS | ████████████████████████████████████████ | 1/1 Components

=== Component Failures [1]
Type   Name     Problem
─────  ───────  ────────────────────────────────────────────────────────────────────────────────────────
Error  TestApp  Unable to build Lightning Component source for markup://c:TestApp: Invalid suffix: json.

ERROR running force:source:deploy:  Deploy failed.

** Even parent directories up the dir tree named "lwc" will cause the issue too. For example, ~/dev/lwc/someother/someother2/someother3/MyApp.

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc

  1. Create a parent directory to contain 1 or more apps. For example, ~/dev/lwc
  2. cd ~/dev/lwc
  3. Create any force app and authorize an org
    $ sfdx force:project:create -n TestApp
    $ cd TestApp
    $ sfdx auth:web:login -a LocalHostDevHub -r https://localhost:6101 -s
    Successfully authorized admin@devhub.localhost.com with org ID 00Dxx0000006H7bEAE
  4. Create a skeleton LWC:
    $ sfdx force:lightning:component:create -n myTest --type lwc -d force-app/main/default/lwc
  5. Attempt to deploy and you will see the issue:
    $ sfdx force:source:deploy -p force-app/main/default/lwc/myTest

Expected result

Should deploy.

Actual result

Cryptic error message is shown:

Error  TestApp  Unable to build Lightning Component source for markup://c:TestApp: Invalid suffix: json.

System Information

sfdx version --verbose --json
{
    "cliVersion": "sfdx-cli/7.136.2",
    "architecture": "darwin-x64",
    "nodeVersion": "node-v16.13.1",
    "pluginVersions": [
        "@oclif/plugin-autocomplete 0.3.0 (core)",
        "@oclif/plugin-commands 1.3.0 (core)",
        "@oclif/plugin-help 3.3.1 (core)",
        "@oclif/plugin-not-found 1.2.6 (core)",
        "@oclif/plugin-plugins 1.10.11 (core)",
        "@oclif/plugin-update 1.5.0 (core)",
        "@oclif/plugin-warn-if-update-available 1.7.3 (core)",
        "@oclif/plugin-which 1.0.4 (core)",
        "@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
        "alias 1.2.0 (core)",
        "apex 0.8.0 (core)",
        "auth 1.8.1 (core)",
        "config 1.3.15 (core)",
        "custom-metadata 1.0.12 (core)",
        "data 0.6.8 (core)",
        "generator 1.2.1 (core)",
        "info 1.2.0 (core)",
        "limits 1.3.0 (core)",
        "org 1.11.1 (core)",
        "salesforce-alm 53.7.6 (core)",
        "schema 1.1.0 (core)",
        "sfdx-cli 7.136.2 (core)",
        "source 1.8.9 (core)",
        "telemetry 1.4.0 (core)",
        "templates 53.3.0 (core)",
        "trust 1.1.0 (core)",
        "user 1.7.0 (core)"
    ],
    "osVersion": "Darwin 21.3.0"
}
github-actions[bot] commented 2 years ago

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

github-actions[bot] commented 2 years ago

This issue has not received a response in 60 days. It will auto-close in 7 days unless a response is posted.

WillieRuemmele commented 1 year ago

I believe this is fixed as of ➜ sf -v @salesforce/cli/2.1.7 darwin-arm64 node v18.16.0

 ➜  mkdir lwc                        
➜  scratches 
 ➜  cd lwc         
➜  lwc 
 ➜  sfdx force project create -n TestApp                             
Warning: The "force project create" command has been deprecated. Use "project generate" instead.
target dir = /Users/william.ruemmele/projects/scratches/lwc
   create TestApp/config/project-scratch-def.json
   create TestApp/README.md
   create TestApp/sfdx-project.json
   create TestApp/.husky/pre-commit
   create TestApp/.vscode/extensions.json
   create TestApp/.vscode/launch.json
   create TestApp/.vscode/settings.json
   create TestApp/force-app/main/default/lwc/.eslintrc.json
   create TestApp/force-app/main/default/aura/.eslintrc.json
   create TestApp/scripts/soql/account.soql
   create TestApp/scripts/apex/hello.apex
   create TestApp/.eslintignore
   create TestApp/.forceignore
   create TestApp/.gitignore
   create TestApp/.prettierignore
   create TestApp/.prettierrc
   create TestApp/jest.config.js
   create TestApp/package.json

➜  lwc 
 ➜  cd TestApp 
➜  TestApp 
 ➜  oc

Creating Scratch Org... 
RequestId: 2SR3i0000008Z3QGAU (https://brave-bear-5fmf7j-dev-ed.my.salesforce.com/2SR3i0000008Z3QGAU)
OrgId: 00DDC0000004Hup 
Username: test-iryhfcskkcwh@example.com 
✓ Prepare Request
✓ Send Request
✓ Wait For Org
✓ Available
✓ Authenticate
✓ Deploy Settings
Done

Your scratch org is ready.
➜  TestApp  hub:(GLOBAL - DevHub) scratch:(test-iryhfcskkcwh@example.com)
 ➜   sfdx force:lightning:component:create -n myTest --type lwc -d force-app/main/default/lwc 
Warning: The "force lightning component create" command has been deprecated. Use "lightning generate component" instead.
target dir = /Users/william.ruemmele/projects/scratches/lwc/TestApp/force-app/main/default/lwc
   create force-app/main/default/lwc/myTest/myTest.js
   create force-app/main/default/lwc/myTest/myTest.html
   create force-app/main/default/lwc/myTest/__tests__/myTest.test.js
   create force-app/main/default/lwc/myTest/myTest.js-meta.xml

➜  TestApp  hub:(GLOBAL - DevHub) scratch:(test-iryhfcskkcwh@example.com)
 ➜  sfdx force:source:deploy -p force-app/main/default/lwc/myTest
Warning: We plan to deprecate this command in the future. Try using the "project deploy start" command instead.
Deploying v58.0 metadata to test-iryhfcskkcwh@example.com using the v58.0 SOAP API.
Deploy ID: 0AfDC00000iheGJ0AY
DEPLOY PROGRESS | ████████████████████████████████████████ | 1/1 Components

=== Deployed Source

 FULL NAME TYPE                     PROJECT PATH                                         
 ───────── ──────────────────────── ──────────────────────────────────────────────────── 
 myTest    LightningComponentBundle force-app/main/default/lwc/myTest/myTest.html        
 myTest    LightningComponentBundle force-app/main/default/lwc/myTest/myTest.js          
 myTest    LightningComponentBundle force-app/main/default/lwc/myTest/myTest.js-meta.xml 
Deploy Succeeded.
➜  TestApp  hub:(GLOBAL - DevHub) scratch:(test-iryhfcskkcwh@example.com)
 ➜  pwd 
/Users/william.ruemmele/projects/scratches/lwc/TestApp