Cli: Cannot authenticate on Windows when installed sfdx-cli through NPM

Created on 1 Dec 2020  路  9Comments  路  Source: forcedotcom/cli

Summary

My pipeline was last successful at 27/11/2020. Today, 01/12/2020, it started to fail for no apparent reason.
Through a lot of trial and error I could confirm the issue is somehow related to installing sfdx-cli through npm, which is the only way I'm aware to install the CLI at the pipeline.
If I manually install on my own desktop with sfdx-windows-amd64.exe, I obtain the version sfdx-cli/7.81.0-7b953c80d1 win32-x64 node-v12.18.3 and can proceed to authenticate without any issues.
If I uninstall, delete the folder .sfdx and use npm install sfdx-cli --global, then I obtain the version sfdx-cli/7.81.0 win32-x64 node-v14.15.0 and fail to authenticate with the exactly same command that would run when not using npm.

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc

NOTE: If your issue is not reproducable by dreamhouse-lwc, i.e. requires specific metadata or files, we require a link to a simple Salesforce project repository with a script to setup a scratch org that reproduces your problem.

  1. Delete the .sfdx folder if it exists
  2. Uninstall sfdx-cli
  3. Run npm install sfdx-cli --global
  4. Attempt to authenticate through sfdx

Expected result

Should successfully authenticate and properly create .sfdx folder with it's contents.

Actual result

Authentication fails with the message: ERROR running auth:jwt:grant: We encountered a JSON web token error, which is likely not an issue with Salesforce CLI. Here鈥檚 the error: We encountered a JSON web token error, which is likely not an issue with Salesforce CLI. Here鈥檚 the error: The service and account specified in key.json do not match the version of the toolbelt.
The folder .sfdx is created with only sfdx.log. The file key.json is nowhere to be found.

Additional information

SFDX CLI Version(to find the version of the CLI engine run sfdx --version):
sfdx-cli/7.81.0 win32-x64 node-v14.15.1

SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)

@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.2.0 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.9.4 (core)
@oclif/plugin-update 1.3.10 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.6.0 (core)
alias 1.1.3 (core)
analytics 1.12.1 (core)
auth 1.4.0 (core)
config 1.2.1 (core)
generator 1.1.3 (core)
salesforcedx 50.6.0 (core)
鈹溾攢 schema 1.0.1 (core)
鈹溾攢 custom-metadata 1.0.10 (core)
鈹溾攢 @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
鈹溾攢 templates 50.1.0 (core)
鈹溾攢 salesforce-alm 50.6.0 (core)
鈹斺攢 apex 0.1.4 (core)
sfdx-cli 7.81.0 (core)

OS and version:
Windows 10

Most helpful comment

@SammyROCK we just published a new version of our auth plugin to fix this:

sfdx plugin:install @salesforce/[email protected]

Let me know if you continue to see this issue

All 9 comments

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.

Same issue here

@SammyROCK Thanks for finding this issue. I'm working on a fix now that will be included in our next release

@SammyROCK we just published a new version of our auth plugin to fix this:

sfdx plugin:install @salesforce/[email protected]

Let me know if you continue to see this issue

Updating "auth" to this new version fixed the same problem for me too! Thanks!

@SammyROCK we just published a new version of our auth plugin to fix this:

sfdx plugin:install @salesforce/[email protected]

Let me know if you continue to see this issue

Even after following the above step, I am still experiencing the problem

I resolved this issue. We need to add "s" after the plugin

CMD : sfdx plugins:install @salesforce/[email protected]

This fixed an issue for me. Thanks!

sfdx plugin:install @salesforce/[email protected]
禄 Warning: plugin:install is not a sfdx command.
Did you mean plugins:install? [y/n]:

At least VS Code tries to help you out if you used the first version without the s on plugins :-)

Was this page helpful?
0 / 5 - 0 ratings