Before you can deploy a function or invoke a function from an org, you must create a compute environment. A compute environment in the Salesforce cloud represents a place where your deployed functions run. When you create a compute environment you specify an org that the compute environment is connected to. That org can then access and invoke functions deployed to that compute environment.
When developing a function, create compute environments associated with your sandbox or scratch orgs. When you’re ready to deploy the function to production, create a compute environment associated with your production org and deploy your function to that compute environment.
To create a compute environment, use the sf env create compute command, specifying the org, and optionally an alias that you can use after the compute environment has been created:
1sf env create compute -o MyOrgAlias -a MyComputeEnv23Creating compute environment for org ID 00D90060200AAPG... done!4New compute environment created with name MyComputeEnv-00D90060000AAPG-afg66b5Connecting environments... done!6Your compute environment with alias "MyComputeEnv" is ready.
List Compute Environments
To check which compute environments you’ve created, use the sf env list command:
1sf env list2Current environments for project MyFunctionProject34Type: Compute Environment5ALIAS PROJECT NAME CONNECTED ORG ALIAS CONNECTED ORG ID COMPUTE ENVIRONMENT NAME6MyComputeEnv MyFunctionProject MyScratchOrgAlias 00DS0000003dRFdTAM myfunct-00ds0000003drfdpam-786
Delete Compute Environments
If you no longer need a compute environment, or you wish to disconnect a connected org, use the sf env delete command with the compute environment alias to remove the compute environment:
Salesforce Functions is no longer available for purchase or renewal. To preserve the capabilities that Salesforce Functions provided to your org, deploy an alternative solution before your existing order term ends. See Salesforce Functions Retirement for more information on migrating your functions. Contact your Salesforce Account Executive for more information on Heroku.