The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

Deploy a Function

Now that you’ve developed and tested your function locally, deploy your project so you can invoke your function from your Salesforce org. The first time a Salesforce Functions project is deployed, the upload can be 500 MB or more.

Before you deploy, commit your functions code changes to a git repo. The deploy process uses changes tracked in git to know what to deploy. Since you just created this project, add the project to a new repo.

From the root directory of your project, use the following git commands:

At this point you can optionally push your changes to github.com, but it isn't required for deploying a function.

Your project is now ready to deploy. If you make additional changes to your function code, use git add and git commit to commit those changes to the repo before deploying again.

For more details on adding your repo to github.com, see Create a repo.

To deploy your project's function, use the following command with the scratch org alias we created earlier.

The deploy process can take several minutes.

To check the status of your deployed project, use sf env list.

For more details on deploying projects, see the Salesforce Functions Developer Guide.