Cli: SFDX project directory requirement is being enforced as a prerun hook

Created on 15 Sep 2020  Â·  8Comments  Â·  Source: forcedotcom/cli

Summary

Recent changes to the CLI version 7.74.1 has introduced a SFDX project directory requirement as a prerun hook. This is causing our CICD / plugin to fail whereever it is calling the CLI from outside a SFDX project directory, for commands that you wouldn't expect to be dependent on a project directory:

e.g.

  • Authentication
  • Listing orgs
  • Listing packages in Dev hub

Steps To Reproduce:

Run command from outside SFDX project directory.

Expected result

Command to execute successfully from any working directory - not necessarily a SFDX project directory.

Actual result

Commands that you would not expect to be tied to a SFDX project directory are failing to execute from a non-project directories.

Additional information

(node:17540) [InvalidProjectWorkspace Plugin: sfdx-cli] InvalidProjectWorkspace Plugin: sfdx-cli: This directory does not contain a valid Salesforce DX project
module: @oclif/[email protected]
task: runHook prerun
plugin: sfdx-cli

SFDX CLI Version(to find the version of the CLI engine run sfdx --version):
CLI Version 7.74.1
SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)
MicrosoftTeams-image

Most helpful comment

Its fixed for now, as the latest tag on core is at 2.11.0

All 8 comments

@amphro Our pipelines started breaking, mainly on the release orchestration side of things, where we don't checkout the repository, (install an unlocked package or do some org operations, there is no need for a sfdx project here)

I confirm, it started breaking for anyone upgrading/freshinstalling since this night (morning).
It was working yesterday with same sfdx-cli package version...
an sfdx project folder (sfdx json definition file) is NOW mandatory for everything, EVEN for creating a SFDX projet

2 workarouds

  • creating the sfdx-project.json file manually
  • force installing salesforcedx@pre-release which only resolves the project creation problem, nothing more

@KevinGossentCap its due to the update in @salesforce/core to 2.12.0, released earlier in the day

@azlam-abdulsalam do we have any way to force downgrade the module ?

I don't think there is an easy way, as its a depenedency of salesforce-alm and many plugins

Thanks for your insite @azlam-abdulsalam .
On our side we booked a high priority Case to Salesforce as lots of processes in the CI chain and in our dev work are breaking because of this issue.
Hoping to see a resolution ASAP.

As a workaround I ended up performing a "touch sfdx-project.json" after installing SFDX CLI from NPM in our CI/CD scripts. Even though it's a empty file it lets the CLI recognize a project file is there and execute commands.

Its fixed for now, as the latest tag on core is at 2.11.0

Was this page helpful?
0 / 5 - 0 ratings