3

I am new at Salesforce DX. I am trying to connect to my account from sfdx plugin,

I typed in the terminal:

sfdx force:org:open -u my_username

but it gives me an error:

ERROR running force:org:open: The service and account specified in key.json do not match the version of the toolbelt.

After extensive search, I couldn't find key.json file anywhere in my code.

The project contains only an empty project (sfdx:create project), and new empty lwc conponents.

2
  • What is the sourceApiVersion attribute value in the sfdx-project.json file? Is that version number the same as the org you're trying to authenticate into? May 14, 2019 at 16:00
  • Yes, they both 45.0 May 14, 2019 at 19:58

4 Answers 4

6

Running the plugin command sfdx plugins:install @salesforce/[email protected] in cmd resolved my above issue.

2
  • This worked. finally.. Thank you guys. @user92082
    – Watson
    Jan 31, 2021 at 23:28
  • This worked for me too, thank you! Wish I had check the plugin version I had before to compare
    – orlybg
    Feb 8, 2021 at 15:15
2

I needed to upgrade my auth plugin using the patch described here.

1

Check whether you have a ".sfdx" directory under your user profile directory: C:/Users/<your username> ( Windows) or /home/<your user name> ( Unix ). It has to have a key.json file with a key and service name as sfdx.

It won't be available by default after you install Sfdx CLI. Hence you need to login to SF first using the following command.

sfdx force:auth:web:login -d -a <any org name>

The above command will open up the default browser window, where you need to enter your Sales force credentials.

Once logged in with your credentials , it will ask whether you allow Salesforce CLI to perform a few things. say yes , and the login will be successful ( you will get a successful message in your command line window , where you invoked the command ) something like the below:

Successfully authorized <your email id> with org ID <organization id> You may now close the browser

Now if you check the .sfdx folder/directory above you should have the key.json file. Further to this, you should not be getting this error anymore.

1

Running sfdx update through the command line resolved this issue for me. I got this key.json warning when trying to allow CLI access to my Salesforce org for the first time rather than when trying to open an already approved org though.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .