0

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.

  • 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? – Kai Tribble May 14 at 16:00
  • Yes, they both 45.0 – user1478469 May 14 at 19:58
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.