- Google cloud SDK
- Go (1.11 or higher)
Make sure to be logged in to GCP in your cli
gcloud auth login
In order to run the function locally, you need to have the default credentials set. The easiest way to go is via gcloud cli:
gcloud auth application-default login
Now you should be able to boot a local server that can run your functions like this:
make serve
Use make file for easier commands
Deploy a function into GCP Cloud Functions
# for dev/staging environment
make deploy-fn fn=<YOUR_FUNC_NAME>
# for prod
make deploy-fn-prod fn=<YOUR_FUNC_NAME>
Calls a function hosted in GCP Cloud Functions
from your local
# for dev/staging environment
make call-fn fn=<YOUR_FUNC_NAME>
# for prod
make call-fn-prod fn=<YOUR_FUNC_NAME>
After booting up a local server, you can use curl or postman to run any function defined locally even if it is not deployed yet. Make sure to have default credentials and the server running first.
curl http://localhost:8080/<YOUR_FUNC_NAME>