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

Different SFDX Report Outcomes #1152

Closed MGarfOppLoans closed 2 years ago

MGarfOppLoans commented 3 years ago

Summary

Running sfdx force:source:deploy provides different outcomes

Steps To Reproduce:

Run sfdx force:source:deploy in nodejs with execSync with a broken (Create a uncompilable apex class and attempt to deploy it. In the following scenarios

In Windows 10 use sfdx-cli/7.94.3-a4e7c7955b win32-x64 node-v14.15.4 (running sfdx update says its the latest version)

In Github Actions use sfdx-cli/7.114.0 linux-x64 node-v14.17.1 or docker image salesforce/salesforcedx:latest-full

In windows it throws a javascript error (sends a error signal in exec) and you have to process the outcome in stdout. In Github Actions no error is thrown and you process it in stdout. These should be identical and one of these outcomes is a bug.

Sample Nodejs Script

const util = require('util');
const { execSync, exec } = require('child_process');
const execAwait = util.promisify(exec);

(async () => {
    console.log('a');
    try {
        await execAwait('sfdx force:source:deploy -p force-app');
    } catch (e) {
        console.log('e');
    }
    console.log('b');

    try {
        const { stdout, stderr } = await execAwait('sfdx force:source:deploy:report --json')
        console.log('aa')
        console.log(stdout);
        console.log('bb');
        console.log(stderr);
        console.log('cc');
    } catch (e) {
        console.log('ee');
        // console.log(e);
        if (e.stdout && e.stdout.startsWith('{')) {
            console.log(JSON.parse(e.stdout));
        }
        console.log('ee2');
    }
})()
github-actions[bot] commented 3 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.

WillieRuemmele commented 3 years ago

Hi @MGarfOppLoans what's the output of sfdx version --verbose on the windows machine? 7.114.0 is the latest release of the CLI. This can happen when you pin a specific plugin, the command above will tell us that. You might have to uninstall/reinstall the CLI to get onto the newer version

MGarfOppLoans commented 3 years ago

that just returns sfdx-cli/7.94.3-a4e7c7955b win32-x64 node-v14.15.4

ran sfdx plugins and it spit out

@oclif/plugin-autocomplete 0.3.0 @salesforce/lwc-dev-server 2.10.0 ├─ @oclif/plugin-help 2.2.3 └─ @oclif/plugin-update 1.3.10 @salesforce/sfdx-diff 0.0.6 @salesforce/sfdx-scanner 2.11.0 evergreen 0.34.0 └─ evergreen-build 0.20.2

MGarfOppLoans commented 3 years ago

This is what happens when i run update

sfdx-cli: Updating CLI... already on latest version: 7.94.3-a4e7c7955b
warning "@salesforce/lwc-dev-server > @rollup/plugin-alias@3.1.1" has unmet peer dependency "rollup@^1.20.0||^2.0.0".
warning "@salesforce/lwc-dev-server > request-promise-native@1.0.8" has unmet peer dependency "request@^2.34".       
warning "@salesforce/lwc-dev-server > request-promise-native > request-promise-core@1.1.3" has unmet peer dependency "request@^2.34".
sfdx-cli: Updating plugins... done
WillieRuemmele commented 3 years ago

can you run sfdx version --verbose it's a different command with more information

mshanemc commented 3 years ago

it's caused by a bug in lwc-dev-server that keeps the CLI on a super old version. Try uninstalling that and then updating?

shetzel commented 2 years ago

@MGarfOppLoans - Please reopen if you are still seeing an issue with the latest CLI.