Manage Compute Environments

Create a Compute Environment for an Org 

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 MyComputeEnv
2
3Creating compute environment for org ID 00D90060200AAPG... done!
4New compute environment created with name MyComputeEnv-00D90060000AAPG-afg66b
5Connecting 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 list
2Current environments for project MyFunctionProject
3
4Type: Compute Environment
5ALIAS        PROJECT NAME      CONNECTED ORG ALIAS CONNECTED ORG ID   COMPUTE ENVIRONMENT NAME
6MyComputeEnv 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:

1sf env delete -e MyComputeEnv

Manage Function Environment Variables 

Manage and set environment variables your function needs at runtime.

Product Retirement Announcement

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.