forcedotcom / salesforcedx-vscode

Salesforce Extensions for VS Code
https://developer.salesforce.com/tools/vscode
BSD 3-Clause "New" or "Revised" License
954 stars 406 forks source link

I can no longer deploy source to org after updating sfdx and vscode extensions for sfdx #4056

Closed sryan-econiq closed 2 years ago

sryan-econiq commented 2 years ago

VSCode extensions for sfdx recently updated to version: v54.9.0 sfdx cli also updated to: sfdx-cli/7.147.1 win32-x64 node-v16.14.2

When I now deploy source to my connected org with VSCode I get the:

10:47:06.730 Starting SFDX: Deploy Source to Org

=== Deploy Errors
10:48:54.68 ended SFDX: Deploy Source to Org

No deploy errors are shown as to why it failed. So I've tried to use the sfdx command directly:

sfdx force:source:deploy -p force-app/main/default -l RunSpecifiedTests -c -r --json

I get the error:

DEPLOY PROGRESS | ████████████████████████████████████████ | 38/38 Components
{
  "status": 1,
  "name": "DeployFailed",
  "message": "Deploy failed.",
  "exitCode": 1,
  "commandName": "Deploy",
  "stack": "DeployFailed: Deploy failed.\n    at DeployResultFormatter.display (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@salesforce\\plugin-source\\lib\\formatters\\deployResultFormatter.js:62:19)\n    at Deploy.formatResult (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@salesforce\\plugin-source\\lib\\commands\\force\\source\\deploy.js:133:23)\n    at Deploy.run (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@salesforce\\plugin-source\\lib\\commands\\force\\source\\deploy.js:35:21)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async Deploy._run (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@salesforce\\command\\lib\\sfdxCommand.js:81:40)\n    at async Config.runCommand (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@oclif\\config\\lib\\config.js:173:24)\n    at async SfdxMain.run (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@oclif\\command\\lib\\main.js:27:9)\n    at async SfdxMain._run (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@oclif\\command\\lib\\command.js:43:20)\n    at async Object.run (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\dist\\cli.js:162:47)",
  "warnings": []
}
jeffb-sfdc commented 2 years ago

@sryan-econiq I was able to reproduce this, and will be looking into this. I found that when I deploy via the extension, I get:

11:52:09.385 Starting Conflict Detection

An error was encountered during conflict detection. MetadataTransferError: Metadata API request failed: Component conversion failed: Method not implemented

...so, not sure if this is the same thing you are getting, but source deploy isn't working for me either.

When I deploy via sfdx force:source:deploy -p force-app/main/default -l RunSpecifiedTests -c -r --json, I get the same error in DeployResultFormatter that you mentioned.

And when I deploy but w/o running the test, via sfdx force:source:deploy -p force-app/main/default --json, I found I was then able to deploy. I'm going to look int this, but in the meantime, you can try deploying w/o running tests.

uip-robot-zz commented 2 years ago

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

jeffb-sfdc commented 2 years ago

@sryan-econiq when you use the extension and VS Code to deploy, which directory are you deploying?

I'm able to deploy force-app/main/default/classes But I'm not able to deploy force-app/main/default This doesn't appear to be be a new issue though - from what I can tell, one wasn't ever able to deploy force-app/main/default

sryan-econiq commented 2 years ago

I was deploying to a production server, so I when back to our sandbox server and the normal deploy by right-clicking on force-app/main/default and calling the SFDX: Deploy Source to Org worked. So I switched back to the production server and the deploy fails with no errors.

After some checking with our other salesforce Administrator a new external package had been installed in production, once we uninstalled this new external package, our deploy started working again in production. The level of error reporting from SFDX needs to be improved.

These sfdx commands from the terminal in visualstudio code still both fail:

sfdx force:source:deploy -p force-app/main/default -l RunSpecifiedTests -c -r --json
sfdx force:source:deploy -p force-app/main/default/classes -l RunSpecifiedTests -c -r --json

With the error:

{
  "status": 1,
  "name": "DeployFailed",
  "message": "Deploy failed.",
  "exitCode": 1,
  "commandName": "Deploy",
  "stack": "DeployFailed: Deploy failed.\n    at DeployResultFormatter.display (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@salesforce\\plugin-source\\lib\\formatters\\deployResultFormatter.js:62:19)\n    at Deploy.formatResult (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@salesforce\\plugin-source\\lib\\commands\\force\\source\\deploy.js:133:23)\n    at Deploy.run (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@salesforce\\plugin-source\\lib\\commands\\force\\source\\deploy.js:35:21)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async Deploy._run (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@salesforce\\command\\lib\\sfdxCommand.js:81:40)\n    at async Config.runCommand (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@oclif\\config\\lib\\config.js:173:24)\n    at async SfdxMain.run (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@oclif\\command\\lib\\main.js:27:9)\n    at async SfdxMain._run (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\node_modules\\@oclif\\command\\lib\\command.js:43:20)\n    at async Object.run (C:\\Users\\sryan\\AppData\\Local\\sfdx\\client\\7.147.1-1633b17\\dist\\cli.js:162:47)",
  "warnings": []
}

I can deploy again in production by right-clicking on force-app/main/default and calling the SFDX: Deploy Source to Org. So for now I can deploy fine to our production server.

jeffb-sfdc commented 2 years ago

Thanks for the update @sryan-econiq . I'm going to close this ticket, however, I agree that there should be more information reported when an error occurs. I opened https://github.com/forcedotcom/salesforcedx-vscode/issues/4066 to track the issue with the extension for VS Code (no enough info report when there is an error), and I opened https://github.com/forcedotcom/cli/issues/1489 to track the issue with the CLI (using the RunSpecifiedTests option)