Unable to create scratch org with Functions feature

salesforce-functionssalesforcedxscratch-orgscratch-org-definition-file

I've installed the latest CLI versions for SFDX and SF, but still when I try to create a scratch org with mentioned commands. I'm getting the below error:

ERROR running force:org:create: Functions is not a valid Features value.

My Project-scratch-def.json file >>>

{
  "orgName": "Functions Recipes",
  "edition": "Developer",
  "features": ["Functions", "EnableSetPasswordInApi"],
  "settings": {
    "lightningExperienceSettings": {
      "enableS1DesktopEnabled": true
    },
    "mobileSettings": {
      "enableS1EncryptedStoragePref2": false
    }
  }
}

Also, SFDX and SF version >>>
sfdx-cli/7.174.0 darwin-x64 node-v16.17.1
@salesforce/cli/1.51.0 darwin-x64 node-v16.17.1

I've also verified that the plugin is installed.

Please help if anyone has faced something similar and resolved it. Thanks!

Best Answer

From the error, it looks like you are NOT connecting to a DevHub org that has the Functions feature enabled.

To use functions within your scratch org, you will need to access to a Functions Enabled Org.

How to get access to Functions Org?

You can obtain a Trial edition of Functions org on first come first serve basis for 30 days using this link.

If you need to enable in your Production orgs contact your Salesforce Account executive.

Note that you can run functions locally too without needing a license. Check this blogpost for more details.

Related Topic