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

`sf project deploy start` behaves incorrectly in Windows Powershell when deploying zip files #2581

Closed tarcang closed 8 months ago

tarcang commented 11 months ago

Summary

sf project deploy start is not able to deploy single package as a zip file in Powershell. If I run the same command in MacOS bash terminal, the behavior is fine.

Steps To Reproduce

Prereq: Have an Windows VM or an environment that runs Powershell 5.

  1. Create a scratch org with Commerce Enabled (you can use sf commerce scratchorg create given that you have a devhub, from @salesforce/commerce
  2. Download this test zip file I was using
  3. Run
    sf project deploy start -o <your_scratch_org> -g --metadata-dir='./b2clocal21ToDeploy.zip' -w 60 --verbose --api-version=59.0 --json --single-package
  4. You will get an output, but not for the individual components. You will get that only package.xml is deployed with no report on the actual components:
    {
    "status": 0,
    "result": {
    "checkOnly": false,
    "completedDate": "2023-11-28T15:45:14.000Z",
    "createdBy": "005TC000000fG41",
    "createdByName": "User User",
    "createdDate": "2023-11-28T15:45:14.000Z",
    "details": {
      "componentSuccesses": [
        {
          "changed": true,
          "componentType": "",
          "created": false,
          "createdDate": "2023-11-28T15:45:14.000Z",
          "deleted": false,
          "fileName": "package.xml",
          "fullName": "package.xml",
          "success": true
        }
      ],
      "runTestResult": {
        "numFailures": 0,
        "numTestsRun": 0,
        "totalTime": 0,
        "codeCoverage": [],
        "codeCoverageWarnings": [],
        "failures": [],
        "flowCoverage": [],
        "flowCoverageWarnings": [],
        "successes": []
      },
      "componentFailures": []
    },
    "done": true,
    "id": "0AfTC000002ODPi0AO",
    "ignoreWarnings": true,
    "lastModifiedDate": "2023-11-28T15:45:14.000Z",
    "numberComponentErrors": 0,
    "numberComponentsDeployed": 0,
    "numberComponentsTotal": 0,
    "numberTestErrors": 0,
    "numberTestsCompleted": 0,
    "numberTestsTotal": 0,
    "rollbackOnError": true,
    "runTestsEnabled": false,
    "startDate": "2023-11-28T15:45:14.000Z",
    "status": "Succeeded",
    "success": true,
    "files": []
    },
    "warnings": []
    }

Expected result

I would get feedback about the components and they should end in success just like in my MacOS system.

Actual result

Nothing is actually deployed in my org.

System Information

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.17.14",
  "nodeVersion": "node-v20.10.0",
  "osVersion": "Windows_NT 10.0.19045",
  "rootPath": "C:\\Users\\tarcan.gul\\AppData\\Roaming\\npm\\node_modules\\@salesforce\\cli",
  "shell": "cmd.exe",
  "pluginVersions": [
    "@mshanemc/plugin-streaming 1.1.7 (user)",
    "@mshanemc/sfdx-sosl 1.1.0 (user)",
    "@oclif/plugin-autocomplete 3.0.1 (core)",
    "@oclif/plugin-commands 3.0.6 (core)",
    "@oclif/plugin-help 6.0.5 (core)",
    "@oclif/plugin-not-found 3.0.3 (core)",
    "@oclif/plugin-plugins 4.1.7 (core)",
    "@oclif/plugin-search 1.0.6 (core)",
    "@oclif/plugin-update 4.1.3 (core)",
    "@oclif/plugin-version 2.0.6 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.2 (core)",
    "@oclif/plugin-which 3.0.8 (core)",
    "@salesforce/cli 2.17.14 (core)",
    "@salesforce/commerce 248.1.3 (user)",
    "apex 2.3.20 (core)",
    "auth 2.8.26 (core)",
    "community 2.4.8 (user)",
    "data 2.6.3 (core)",
    "deploy-retrieve 1.20.0 (core)",
    "info 3.0.1 (core)",
    "limits 3.0.1 (core)",
    "login 2.0.1 (core)",
    "marketplace 1.0.2 (core)",
    "org 2.11.8 (core)",
    "schema 3.0.1 (core)",
    "settings 2.0.2 (core)",
    "sobject 0.2.15 (core)",
    "source 2.11.0 (core)",
    "telemetry 3.1.0 (core)",
    "templates 55.5.18 (core)",
    "trust 3.0.2 (core)",
    "user 2.3.42 (core)",
    "shane-sfdx-plugins 4.43.0 (user)"
  ]
}

Additional information

Note: the output shell says 'cmd.exe' but I am actually running that from Powershell.

$PSVersionTable output:

Name                           Value
----                           -----
PSVersion                      5.1.19041.3031
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.3031
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

The doctor output of the command I shared in Windows:

[07:45:09.856] TRACE (sf:core:config): Created 'sf:core:config' child logger instance
[07:45:09.856] TRACE (sf): Setup child 'sf:core:config' logger instance
[07:45:11.969] TRACE (sf:Config): Created 'sf:Config' child logger instance
[07:45:11.969] TRACE (sf): Setup child 'sf:Config' logger instance
[07:45:11.970] TRACE (sf:Config): Created 'sf:Config' child logger instance
[07:45:11.970] TRACE (sf): Setup child 'sf:Config' logger instance
[07:45:11.970] INFO (sf:Config): Reading config file: C:\Users\tarcan.gul\.sf\config.json
[07:45:11.970] INFO (sf:Config): Reading config file: C:\Users\tarcan.gul\.commerce\devhubs\admin_tarcanATsdb3DOTcom\patch1_windowsATscratchDOTcom\.sf\config.json
[07:45:12.000] TRACE (sf:OrgAccessor): Created 'sf:OrgAccessor' child logger instance
[07:45:12.000] TRACE (sf): Setup child 'sf:OrgAccessor' logger instance
[07:45:12.000] TRACE (sf:SandboxAccessor): Created 'sf:SandboxAccessor' child logger instance
[07:45:12.000] TRACE (sf): Setup child 'sf:SandboxAccessor' logger instance
[07:45:12.001] TRACE (sf:TokensConfig): Created 'sf:TokensConfig' child logger instance
[07:45:12.001] TRACE (sf): Setup child 'sf:TokensConfig' logger instance
[07:45:12.001] TRACE (sf:crypto): Created 'sf:crypto' child logger instance
[07:45:12.001] TRACE (sf): Setup child 'sf:crypto' logger instance
[07:45:12.001] DEBUG (sf:crypto): retryStatus: undefined
[07:45:12.001] TRACE (sf:keyChain): Created 'sf:keyChain' child logger instance
[07:45:12.001] TRACE (sf): Setup child 'sf:keyChain' logger instance
[07:45:12.002] DEBUG (sf:keyChain): platform: win32
[07:45:12.004] INFO (sf:TokensConfig): Reading config file: C:\Users\tarcan.gul\.sfdx\tokens.json
[07:45:12.005] TRACE (sf:Org): Created 'sf:Org' child logger instance
[07:45:12.005] TRACE (sf): Setup child 'sf:Org' logger instance
[07:45:12.005] TRACE (sf:AuthInfoConfig): Created 'sf:AuthInfoConfig' child logger instance
[07:45:12.005] TRACE (sf): Setup child 'sf:AuthInfoConfig' logger instance
[07:45:12.006] TRACE (sf:crypto): Created 'sf:crypto' child logger instance
[07:45:12.006] TRACE (sf): Setup child 'sf:crypto' logger instance
[07:45:12.006] DEBUG (sf:crypto): retryStatus: undefined
[07:45:12.006] TRACE (sf:keyChain): Created 'sf:keyChain' child logger instance
[07:45:12.006] TRACE (sf): Setup child 'sf:keyChain' logger instance
[07:45:12.006] DEBUG (sf:keyChain): platform: win32
[07:45:12.007] INFO (sf:AuthInfoConfig): Reading config file: C:\Users\tarcan.gul\.sfdx\patch1_windows@scratch.com.json
[07:45:12.009] TRACE (sf:AuthInfo): Created 'sf:AuthInfo' child logger instance
[07:45:12.009] TRACE (sf): Setup child 'sf:AuthInfo' logger instance
[07:45:12.015] INFO (sf:AuthInfo): Returning fields for a connection using OAuth config.
[07:45:12.017] TRACE (sf:connection): Created 'sf:connection' child logger instance
[07:45:12.017] TRACE (sf): Setup child 'sf:connection' logger instance
[07:45:12.021] DEBUG (sf:connection): API version cache last checked on 11/28/2023, 6:57:37 AM (now is 11/28/2023, 7:45:12 AM)
[07:45:12.021] DEBUG (sf:connection): Using cached API version: 59.0
[07:45:12.021] DEBUG (sf:connection): Connection created with apiVersion 59.0
[07:45:12.134] TRACE (sf:Org): Created 'sf:Org' child logger instance
[07:45:12.134] TRACE (sf): Setup child 'sf:Org' logger instance
[07:45:12.134] TRACE (sf:AuthInfoConfig): Created 'sf:AuthInfoConfig' child logger instance
[07:45:12.134] TRACE (sf): Setup child 'sf:AuthInfoConfig' logger instance
[07:45:12.135] TRACE (sf:crypto): Created 'sf:crypto' child logger instance
[07:45:12.135] TRACE (sf): Setup child 'sf:crypto' logger instance
[07:45:12.135] DEBUG (sf:crypto): retryStatus: undefined
[07:45:12.135] TRACE (sf:keyChain): Created 'sf:keyChain' child logger instance
[07:45:12.135] TRACE (sf): Setup child 'sf:keyChain' logger instance
[07:45:12.135] DEBUG (sf:keyChain): platform: win32
[07:45:12.135] INFO (sf:AuthInfoConfig): Reading config file: C:\Users\tarcan.gul\.sfdx\patch1_windows@scratch.com.json
[07:45:12.136] TRACE (sf:AuthInfo): Created 'sf:AuthInfo' child logger instance
[07:45:12.136] TRACE (sf): Setup child 'sf:AuthInfo' logger instance
[07:45:12.140] INFO (sf:AuthInfo): Returning fields for a connection using OAuth config.
[07:45:12.140] TRACE (sf:connection): Created 'sf:connection' child logger instance
[07:45:12.140] TRACE (sf): Setup child 'sf:connection' logger instance
[07:45:12.141] DEBUG (sf:connection): API version cache last checked on 11/28/2023, 6:57:37 AM (now is 11/28/2023, 7:45:12 AM)
[07:45:12.141] DEBUG (sf:connection): Using cached API version: 59.0
[07:45:12.141] DEBUG (sf:connection): Connection created with apiVersion 59.0
[07:45:12.143] TRACE (sf:SfProjectJson): Created 'sf:SfProjectJson' child logger instance
[07:45:12.143] TRACE (sf): Setup child 'sf:SfProjectJson' logger instance
[07:45:12.143] INFO (sf:SfProjectJson): Reading config file: C:\Users\tarcan.gul\.commerce\devhubs\admin_tarcanATsdb3DOTcom\patch1_windowsATscratchDOTcom\sfdx-project.json
[07:45:12.148] TRACE (sf:Org): Created 'sf:Org' child logger instance
[07:45:12.148] TRACE (sf): Setup child 'sf:Org' logger instance
[07:45:12.148] TRACE (sf:AuthInfoConfig): Created 'sf:AuthInfoConfig' child logger instance
[07:45:12.148] TRACE (sf): Setup child 'sf:AuthInfoConfig' logger instance
[07:45:12.148] TRACE (sf:crypto): Created 'sf:crypto' child logger instance
[07:45:12.148] TRACE (sf): Setup child 'sf:crypto' logger instance
[07:45:12.148] DEBUG (sf:crypto): retryStatus: undefined
[07:45:12.148] TRACE (sf:keyChain): Created 'sf:keyChain' child logger instance
[07:45:12.148] TRACE (sf): Setup child 'sf:keyChain' logger instance
[07:45:12.148] DEBUG (sf:keyChain): platform: win32
[07:45:12.149] INFO (sf:AuthInfoConfig): Reading config file: C:\Users\tarcan.gul\.sfdx\patch1_windows@scratch.com.json
[07:45:12.149] TRACE (sf:AuthInfo): Created 'sf:AuthInfo' child logger instance
[07:45:12.149] TRACE (sf): Setup child 'sf:AuthInfo' logger instance
[07:45:12.154] INFO (sf:AuthInfo): Returning fields for a connection using OAuth config.
[07:45:12.154] TRACE (sf:connection): Created 'sf:connection' child logger instance
[07:45:12.154] TRACE (sf): Setup child 'sf:connection' logger instance
[07:45:12.154] DEBUG (sf:connection): API version cache last checked on 11/28/2023, 6:57:37 AM (now is 11/28/2023, 7:45:12 AM)
[07:45:12.154] DEBUG (sf:connection): Using cached API version: 59.0
[07:45:12.154] DEBUG (sf:connection): Connection created with apiVersion 59.0
[07:45:12.154] WARN (sf:Org): Default API version is already 59.0
[07:45:12.154] TRACE (sf:MetadataApiDeploy): Created 'sf:MetadataApiDeploy' child logger instance
[07:45:12.154] TRACE (sf): Setup child 'sf:MetadataApiDeploy' logger instance
[07:45:12.156] DEBUG (sf:MetadataApiDeploy): Deploying metadata source using SOAP v59.0
[07:45:13.542] DEBUG (sf:MetadataApiDeploy): Started metadata transfer. ID = 0AfTC000002ODPi0AO
[07:45:13.542] TRACE (sf:DeployCache): Created 'sf:DeployCache' child logger instance
[07:45:13.542] TRACE (sf): Setup child 'sf:DeployCache' logger instance
[07:45:13.543] INFO (sf:DeployCache): Reading config file: C:\Users\tarcan.gul\.sf\deploy-cache.json
[07:45:13.545] INFO (sf:DeployCache): Writing to config file: C:\Users\tarcan.gul\.sf\deploy-cache.json
[07:45:13.570] TRACE (sf:PollingClient): Created 'sf:PollingClient' child logger instance
[07:45:13.570] TRACE (sf): Setup child 'sf:PollingClient' logger instance
[07:45:13.570] DEBUG (sf:MetadataApiDeploy): Polling for metadata transfer status. ID = 0AfTC000002ODPi0AO
[07:45:13.570] DEBUG (sf:MetadataApiDeploy): Polling frequency (ms): 1000
[07:45:13.570] DEBUG (sf:MetadataApiDeploy): Polling timeout (min): 60
[07:45:14.359] DEBUG (sf:MetadataApiDeploy): MDAPI status update: Succeeded
[07:45:14.362] TRACE (sf:DeployCache): Created 'sf:DeployCache' child logger instance
[07:45:14.362] TRACE (sf): Setup child 'sf:DeployCache' logger instance
[07:45:14.362] INFO (sf:DeployCache): Reading config file: C:\Users\tarcan.gul\.sf\deploy-cache.json
[07:45:14.363] INFO (sf:DeployCache): Writing to config file: C:\Users\tarcan.gul\.sf\deploy-cache.json
{
  "status": 0,
  "result": {
    "checkOnly": false,
    "completedDate": "2023-11-28T15:45:14.000Z",
    "createdBy": "005TC000000fG41",
    "createdByName": "User User",
    "createdDate": "2023-11-28T15:45:14.000Z",
    "details": {
      "componentSuccesses": [
        {
          "changed": true,
          "componentType": "",
          "created": false,
          "createdDate": "2023-11-28T15:45:14.000Z",
          "deleted": false,
          "fileName": "package.xml",
          "fullName": "package.xml",
          "success": true
        }
      ],
      "runTestResult": {
        "numFailures": 0,
        "numTestsRun": 0,
        "totalTime": 0,
        "codeCoverage": [],
        "codeCoverageWarnings": [],
        "failures": [],
        "flowCoverage": [],
        "flowCoverageWarnings": [],
        "successes": []
      },
      "componentFailures": []
    },
    "done": true,
    "id": "0AfTC000002ODPi0AO",
    "ignoreWarnings": true,
    "lastModifiedDate": "2023-11-28T15:45:14.000Z",
    "numberComponentErrors": 0,
    "numberComponentsDeployed": 0,
    "numberComponentsTotal": 0,
    "numberTestErrors": 0,
    "numberTestsCompleted": 0,
    "numberTestsTotal": 0,
    "rollbackOnError": true,
    "runTestsEnabled": false,
    "startDate": "2023-11-28T15:45:14.000Z",
    "status": "Succeeded",
    "success": true,
    "files": []
  },
  "warnings": []
}

I will not share the doctor command output in my macOS since it is long but I do get successes with the individual components.

github-actions[bot] commented 11 months 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.

mshanemc commented 11 months ago

huh. I don't have my windows machine this week, sorry. Can you try a few things for me?

[remove the = stuff for flags and refer to the --metadata-dir sf project deploy start -o <your_scratch_org> -g --metadata-dir b2clocal21ToDeploy.zip -w 60 --verbose --api-version 59.0 --json --single-package

[same but without --single-package] sf project deploy start -o <your_scratch_org> -g --metadata-dir b2clocal21ToDeploy.zip -w 60 --verbose --api-version 59.0 --json

tarcang commented 11 months ago

huh. I don't have my windows machine this week, sorry. Can you try a few things for me?

[remove the = stuff for flags and refer to the --metadata-dir sf project deploy start -o <your_scratch_org> -g --metadata-dir b2clocal21ToDeploy.zip -w 60 --verbose --api-version 59.0 --json --single-package

[same but without --single-package] sf project deploy start -o <your_scratch_org> -g --metadata-dir b2clocal21ToDeploy.zip -w 60 --verbose --api-version 59.0 --json

I will 👍

tarcang commented 11 months ago

Hello @mshanemc , I have tried the commands you have shared but unfortunately still got the same output. I have looked into this a little bit. Looking into the deployment logic I don't see any apparent reason why this wouldn't work other than the fact that there is something wrong with the JSZip library with its Windows compatibility. I am not sure, just putting out an idea on where it could be going wrong.

github-actions[bot] commented 10 months ago

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

tarcang commented 10 months ago

Hello @mshanemc, any updates on this issue? I will try to help as much I can.

github-actions[bot] commented 9 months ago

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

github-actions[bot] commented 9 months ago

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

mshanemc commented 9 months ago

I've tried replicating this on windows.

I created a scratch org using this scratch definition file https://github.com/forcedotcom/commerce-on-lightning/blob/develop/config/b2b-project-scratch-def.json

When I deploy the zip file, I got back various errors (navigation menus that don't have network associated with them)


I also tried installing the commerce plugin and running sf commerce scratchorg create but that resulted in a lot of errors like INVALID_EMAIL_ADDRESS. Looks like it requires a --username for some reason? That at least got the org to create.


Then I deployed your zip file. I got more failures.

In all cases, I didn't have long deploys and it seemed to behave correctly (returning results for the errors).

What am I missing?

github-actions[bot] commented 8 months ago

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