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

sf project deploy validate is not explaining why validation failed #2757

Closed JavierCarvajalLBS closed 7 months ago

JavierCarvajalLBS commented 7 months ago

Summary

When running a "sf project deploy validate" command, the validation fails, but the only message received is:

FailedValidationError: Failed to validate the deployment (XXXXXXXXXXXXX). Due To:\n1 component error(s)

Steps To Reproduce

The following command was executed:

project deploy validate --manifest \"${PACKAGE_XML_PATH}\" --test-level RunLocalTests --wait 120 --verbose --target-org Prod --json > output.txt

The package.xml contains:

Expected result

The deployment should be validated or, if canceled, an explanation of the cancelation reason should be received.

Actual result

The validation is canceled after a couple of minutes with the following message:

FailedValidationError: Failed to validate the deployment (XXXXXXXXXXXXX). Due To:\n1 component error(s)

System Information

The command is executed through a Jenkins job, that can deploy without issues. Now, we are including the validation option.

The sf CLI was updated today with the latest version available

sf version --verbose --json
{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.30.8",
  "nodeVersion": "node-v20.11.1",
  "osVersion": "Windows_NT 10.0.17763",
  "rootPath": "D:\\Program Files\\sf\\client",
  "shell": "cmd.exe",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.9 (core)",
    "@oclif/plugin-commands 3.1.4 (core)",
    "@oclif/plugin-help 6.0.13 (core)",
    "@oclif/plugin-not-found 3.0.11 (core)",
    "@oclif/plugin-plugins 4.2.5 (core)",
    "@oclif/plugin-search 1.0.16 (core)",
    "@oclif/plugin-update 4.1.13 (core)",
    "@oclif/plugin-version 2.0.12 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.12 (core)",
    "@oclif/plugin-which 3.1.0 (core)",
    "@salesforce/cli 2.30.8 (core)",
    "apex 3.0.25 (core)",
    "auth 3.3.13 (core)",
    "data 3.1.1 (core)",
    "deploy-retrieve 3.2.16 (core)",
    "info 3.0.27 (core)",
    "limits 3.1.10 (core)",
    "marketplace 1.0.25 (core)",
    "org 3.3.14 (core)",
    "packaging 2.1.10 (core)",
    "schema 3.1.3 (core)",
    "settings 2.0.27 (core)",
    "sobject 1.1.13 (core)",
    "source 3.1.15 (core)",
    "telemetry 3.1.13 (core)",
    "templates 56.0.16 (core)",
    "trust 3.3.10 (core)",
    "user 3.2.11 (core)"
  ]
}
github-actions[bot] commented 7 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.

JavierCarvajalLBS commented 7 months ago

I forgot to mention that the issue happens in a Production org. With the same command and package in a sandbox, validation cancels after more than 20 minutes due to insufficient code coverage in a trigger due to the execution of all local tests in the sandbox.

git2gus[bot] commented 7 months ago

This issue has been linked to a new work item: W-15207335

shetzel commented 7 months ago

Looks like you can get the detailed failure messages if you don't use the --json flag. This happens when there are errors in the deployed metadata components. We'll fix the bug. Thanks for reporting.

JavierCarvajalLBS commented 7 months ago

@shetzel you were right When I removed the --json parameter and executed the validation again, I could read the entire response in the log file. Then, we´ll wait until it is fixed, as we need to capture the response in a json file to analyze and extract everything.

jshackell-sfdc commented 7 months ago

This issue is fixed in Salesforce CLI release 2.33.3.