Deploy the Function

At this time there are no Salesforce Extensions for VS Code commands that perform any tasks related to deploying the Function. Execute all the following steps in the terminal in your VSCode.

Add Project to git

Because Functions aren’t deployed to an org, you’ll want to use git to save and track changes to your Functions source files. The deploy process uses changes tracked in git to know what to deploy. Since you just created this project, you'll add the project to a new repo.

You may need to install the GitHub Pull Requests and Issues (https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github) VS Code extension first.

To add your project to a git repo:

  1. Click on the source control menu on the sidebar (or press Ctrl+Shift+G)
  2. Click “Publish to github” and follow the directions

For more details see https://code.visualstudio.com/docs/editor/github

Deploy the Function to the Compute Environment

Deploy the Function to the compute environment using the following CLI commands from the VS Code terminal. Note that you provide the org alias the Salesforce platform determines which compute environment to use based on the org information.

The deploy process may take several minutes. The Function is built and then deployed to the appropriate compute environment.

You can check the status of your deployed Functions using sfdx env:list:

For more details on deploying with existing Salesforce Functions compute environments, see the Salesforce Functions Developer Guide.