Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add deploy errors to validate error message #938

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

shetzel
Copy link
Contributor

@shetzel shetzel commented Mar 11, 2024

What does this PR do?

Move some error discovery code to a common function so it can be used by the command or the formatter

What issues does this PR fix or reference?

@W-15207335@

@mdonnalley
Copy link
Collaborator

QA

  • linked plugin-deploy-retrieve to sf
  • create scratch org in dreamhouse-lwc, sf org create scratch --edition developer --alias scratch-org
  • Referenced an unknown class in force-app/main/default/classes/FileUtilities

✅ Failed (human readable)

❯ sf project deploy validate -d force-app -o scratch-org
 ›   Warning: @salesforce/plugin-deploy-retrieve is a linked ESM module and cannot be auto-transpiled. Existing compiled source will
 ›   be used instead.
Validating Deployment of v60.0 metadata to test-yumbdjqp2die@example.com using the v60.0 REST API.
Deploy ID: 0Af5300001CF1liCAD
Status: Failed | ████████████████████████████████████████ | 92/92 Components | Errors: 3

Component Failures [3]
=====================================================================================================
| Type  Name              Problem                                                         Line:Column
| ───── ───────────────── ─────────────────────────────────────────────────────────────── ───────────
| Error FileUtilities     Invalid type: ContentVersion2 (9:45)                            9:45
| Error FileUtilitiesTest Dependent class is invalid and needs recompilation:             9:45
|                          Class FileUtilities : Invalid type: ContentVersion2 (9:45)
| Error propertyCarousel  Unable to find Apex action class referenced as 'FileUtilities'.

Test Results Summary
Passing: 0
Failing: 0
Total: 0
Error (1): Failed to validate the deployment (0Af5300001CF1liCAD). Due To:
Error in FileUtilities - Invalid type: ContentVersion2 (9:45)
Error in FileUtilitiesTest - Dependent class is invalid and needs recompilation:
 Class FileUtilities : Invalid type: ContentVersion2 (9:45)
Error in propertyCarousel - Unable to find Apex action class referenced as 'FileUtilities'.

3 component error(s)

✅ Failed (--json)

❯ sf project deploy validate -d force-app -o scratch-org --json
 ›   Warning: @salesforce/plugin-deploy-retrieve is a linked ESM module and cannot be auto-transpiled. Existing compiled source will
 ›   be used instead.
{
  "code": 1,
  "context": "DeployMetadataValidate",
  "commandName": "DeployMetadataValidate",
  "data": {
    "deployId": "0Af5300001CF1jNCAT"
  },
  "message": "Failed to validate the deployment (0Af5300001CF1jNCAT). Due To:\nError in FileUtilities - Invalid type: ContentVersion2 (9:45)\nError in FileUtilitiesTest - Dependent class is invalid and needs recompilation:\n Class FileUtilities : Invalid type: ContentVersion2 (9:45)\nError in propertyCarousel - Unable to find Apex action class referenced as 'FileUtilities'.\n\n3 component error(s)",
  "name": "FailedValidationError",
  "status": 1,
  "stack": "FailedValidationError: Failed to validate the deployment (0Af5300001CF1jNCAT). Due To:\nError in FileUtilities - Invalid type: ContentVersion2 (9:45)\nError in FileUtilitiesTest - Dependent class is invalid and needs recompilation:\n Class FileUtilities : Invalid type: ContentVersion2 (9:45)\nError in propertyCarousel - Unable to find Apex action class referenced as 'FileUtilities'.\n\n3 component error(s)\n    at Messages.createError (/Users/mdonnalley/repos/salesforcecli/plugin-deploy-retrieve/node_modules/@salesforce/core/lib/messages.js:431:16)\n    at DeployMetadataValidate.run (file:///Users/mdonnalley/repos/salesforcecli/plugin-deploy-retrieve/lib/commands/project/deploy/validate.js:203:18)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async DeployMetadataValidate._run (/Users/mdonnalley/repos/salesforcecli/plugin-deploy-retrieve/node_modules/@oclif/core/lib/command.js:304:22)\n    at async Config.runCommand (/Users/mdonnalley/.volta/tools/image/packages/@salesforce/cli/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:426:25)\n    at async run (/Users/mdonnalley/.volta/tools/image/packages/@salesforce/cli/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/main.js:85:16)",
  "exitCode": 1,
  "warnings": []
}

@mdonnalley mdonnalley merged commit d60804b into main Mar 11, 2024
40 checks passed
@mdonnalley mdonnalley deleted the sh/error-messages-during-validate branch March 11, 2024 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants