function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nancy Smith 32Nancy Smith 32 

Salesforce DX trailhead error: You do not have access to the [scratchorgiinfo] object

I installed Developer Hub Trial Org 64-bit Windows option.
I created a trial project with: 
     sfdx force:project:create -n geolocation

But, when I try to create the scratch org with:
      sfdx force:org:create -s -f config/project-scratch-def.json -a GeoAppScratch
I get this:
     ERROR running force:org:create: You do  not have access to the [scratchorgiinfo] object

I've tried several suggested fixes that I found when I searched for the above error. None has resolved the issue for me.
Alap MistryAlap Mistry
Hello Nancy Smith,
Are you use below command before create an scratch org? OR delete that org and create one with same name.
cd Geolocation
If it is useful, then mark it as best answer for close this thread.
Regards,
Alap Mistry
dimasdimas
I tried 3 different suggestions I found online. None of them resolved the issue. At one point I thought it was computer related so I tried on a Mac and a PC - same thing. Does anyone have any idea?
IMManishIMManish
Hi Nancy and dimas,
Did you register for a dev hub org  from here https://developer.salesforce.com/promotions/orgs/dx-signup. You need to register for a dev hub org as first step. Download the SFDX CLI tool .. You are mentioning "installed Developer Hub Trial Org 64-bit Windows option" .. I assume you are referring to SFDX CLI tool. This is the second step. Third .. you need to authorize the dev hub org. and after that you can start creating the scratch org. In case this is not working, try creating a permission set on the dev hub org providing CRUD on Scratch Org Info, Active Scratch Org and Namespace Registry objects.
dimasdimas
@IMManish That link made all the difference. I was signing up for a regular trial org but Dev Hub is in open beta so you need that particular link to register for a Dev Hub org. Thank you!
IMManishIMManish
@dimas - Glad to hear that your problem is solved.
Luke Lemker 17Luke Lemker 17
If you still run into the issue after creating the permission set and assigning to yourself in your DevHub, try executing the force:auth:web:login command again that you used at the very beginning of the trailhead.  That finally worked for me.
Gbolahan JolapamoGbolahan Jolapamo
Hi everyone,
The Dev Hub is comprised of objects with permissions that allow admins to control the level of access available to a user and an org. I tried accessing the dev hub from the quick find box so as to give access to these objects to devhub users but the dev hub option isnt available. I use the trial edition and my developer org as my dev hub org. 

How do I give access to these objects from my org? Itried creating a scratch org and i am having error accessing the scratchinfo object.

Any help would be great. thanks
Gbolahan JolapamoGbolahan Jolapamo
Ok, I figured how the dev hub org works now, thanks. 
brahmaji tammanabrahmaji tammana
A Developer Hub (Dev Hub) is the main Salesforce org that you and your team use to create and manage your scratch orgs. If you try to create a scratch org under non-devhub org, you may get that error.

So you need to authourize developer hub (not developer org) using sfdx command and then run your scratch org command.

Authorize with this command: sfdx force:auth:web:login -d -a DevHub

Then enter your command to create a scratch org under this devhub.

 
Chetan Kamble 1Chetan Kamble 1
login to devhub using new 30 days DX org.
Use the following link.
https://developer.salesforce.com/promotions/orgs/dx-signup
Sean LimSean Lim
I'm getting the same error. Is there any solution for this yet?
Efraim Taranto 1Efraim Taranto 1
I found the instructions to complete this Trailheads a bit confusing, but I've managed to work them out and verified them at the end. These are the steps I've followed:

1 - From previous steps, I've used the DX trial version obtained by registering at https://developer.salesforce.com/promotions/orgs/dx-signup
2 - create project MutualFundExplorer
sfdx force:project:create -n MutualFundExplorer
3 - Change directory: 
cd MutualFundExplorer
4 - Login into my DX trial Org --> At this stage I selected the Org I've created in step 1
sfdx force:auth:web:login -d -a DevHub
5 - Create a new Scratch Org
sfdx force:org:create -f config/project-scratch-def.json -a TempUnmanaged
6 - Generate password for org
sfdx force:user:password:generate -u TempUnmanaged
7 - get the following variables by querying the org (you will use them in the next step): Instance UrlUsername and Password
sfdx force:org:display -u TempUnmanaged
8 - now follow the link to download the package: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t46000001DnYm
a couple of things on this steps: (1) logout from any org you are so the install does not auto launch and (2) follow the link. You will be prompted with the salesforce login page. Click on Log In with a Different Username and then click on the link below Use Custom Domain. Paste the Instance URL obtained in Step 7 and the use the credentials after clicking Continue.
9 -Once the package has finished installing, create the permission set in the Scratch Org
10 - pull the data into your local drive
sfdx force:source:pull -u TempUnmanaged
11-create package directory
mkdir mdapipackage
12 - Unzip the package: the instruction in the trailhead didn't make the trick for me, so i went to Windows Explorer and extracted it myself:
User-added image
13 - Convert the package and get everything ready for deployment
sfdx force:mdapi:retrieve -s -r ./mdapipackage -p DreamInvest -u TempUnmanaged -w 10
14 - Now begin the tricky part, here you create a new login to the org you will use to validate this module, in my case I've called it TH When the browser prompts you with the credentials, you select the user and password for your trailhead
sfdx force:auth:web:login -a TH
15 - Deploy the project into your org
sfdx force:mdapi:deploy -d mdapioutput/ -u TH -w 100
16 - Here is the second trick, if you attempt to validate the module it will fail telling you that the app could not be found. Here is where you go to your Trailhead org and go Setup, Users, select your user and add the DreamInvest permission set

I may have skipped some steps but if you mix these instructions with the instructions in https://trailhead.salesforce.com/modules/sfdx_app_dev/units/sfdx_app_dev_deploy you will be able to finish the module

I hope this may help others!



 


 
Stevie Jean-LouisStevie Jean-Louis
hello, to solve your problem please check that you have the right ScratchOrgInfo on the object, I had the same problem and adding itself right everything was oki after
narayana reddy 19narayana reddy 19
where should I find ScratchOrgInfo? 

I am also getting the asme issue ERROR:  You do not have access to the [ScratchOrgInfo] object.
Dave_BoyceDave_Boyce

I was getting the same error

sfdx force:org:create -f orgs/dev.json -n --durationdays 7 -a [alias]

Error: You do not have access to the [ScratchOrgInfo] object

Resolution:

sfdx force:auth:web:login -d -a DevHub

Issue Explained:

https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_auth.htm#cli_reference_force_auth
-d | --setdefaultdevhubusername
Optional
Sets the authenticated org as the default Dev Hub org for scratch org creation.
Type: flag

The issue was my defaultdevhubusername was pointing to a different org.  When you call sfdx force:auth:web:login w/ the -d flag it will also set the defaultdevhubusername that is used for scratch org auth.

Alternatively if you already have the user setup in your keychain you can just set the defaultdevhubusername directly without creating a new key chain alias.
 

sfdx force:config:set defaultdevhubusername=[username]
imrohitimrohit

Hi All

This error usually comes if you didn't Enabled Dev Hub Org

here are the steps to Enable Dev Hub 

  1. Login to Salesforce DevHub Org Click on setup
  2. type Dev Hub there and click on Dev Hub
  3. Enable Dev Hub by clicking on the button there
After doing this try to create scratch org, You will not get the same error again.
Hope this will help

Thanks
system Admin 790system Admin 790
@nancy smith 
1. Just enable the Dev Hub in ur salesforce org thats lear the error.
User-added image

thanks.
bibek gorainbibek gorain
open
https://playful-badger-irqyzo-dev-ed.lightning.force.com/lightning/setup/DevHub/home
enable the dev hub :)
Cherish Reddy 17Cherish Reddy 17
Hi SFDC Batch28,
I had faced the same issue. So what I did was:

1) check-in ur terminal of Visual studio code : sfdx force:org:list --all and see which all are authorized org and search for D next to it. Here D refers to as flag for Dev Hub and see to that you have only one D flag. 
User-added image
 
2)check if you have enabled Dev hub for the D flag authorized org. If not first login to that org and go to Setup > quick find > search for Dev Hub > Click on Dev Hub > Enable it as shown in the screenshot below. 
User-added image

3)Always remember that whenever you are dealing with Visual studio code and Salesforce CLI topics in trailhead, you need to authorize and login only with your newly created Trailhead Playgrounds (note: create one and use it for all the VSC topics) not with the developer account that you have.
User-added image

4)Now when all this is done. You can sfdx force:org:list --clean to clean all the previous expired scratch orgs.
User-added image
5)Now give the scratch org command sfdx force:org:create -s -f config/project-scratch-def.json -a GeoAppScratch and check. You will get the success message as seen below. 
User-added image

If you think I answered your question then please mark this as the best answer and share. I am in learning stage so if anyone finds this to be a mistake please let me know. But this was my understanding to the problem and it was solved.

 
MadhuSmitha Kandegani 5MadhuSmitha Kandegani 5
Give this command
fdx plugins:install @salesforce/plugin-auth@1.4.3 
It worked for me after 30min search.. it installs the necessary plugins and works finally
MadhuSmitha Kandegani 5MadhuSmitha Kandegani 5
sfdx plugins:install @salesforce/plugin-auth@1.4.3