This page shows you how to install and run Functions Frameworks for local development.
Before you begin
If this is your first time using Cloud Functions with Cloud Code, see the Create and deploy a function quickstart. Once you've created and deployed a function using a Cloud Code sample, you can return to this guide to setup a local development environment.
Install and run Functions Framework locally
To install and run Functions Framework locally, follow these steps:
In VS Code, click Cloud Code and then expand the Cloud Functions explorer.
Expand your Google Cloud project, right-click a deployed function of your choice, and select Download to new workspace. This downloads the source code of your function from Google Cloud to your local machine and creates a new workspace in your IDE.
Click View > Terminal to open the terminal in VS Code.
To install the local dependencies to your function's local folder, navigate to your function's local folder in the terminal and then run the following:
pip install functions-framework
To run the local Functions Framework, run the following:
npx functions-framework --target=entryPoint
To find the
entryPointof your function, open your
launch.jsonfile and look for the assigned value of
For example, if you're using Cloud Code's Hello World sample application, the configuration appears as follows:
To test your function, when prompted, click Open in Browser, or click + New Terminal and run the following:
This shows the context of the function in the terminal.
For more information on how to call locally running functions, see Running Functions with Function Frameworks.