Google Cloud Functions local development


Testing and developing Google Cloud Functions via the Cloud Console is tedious, as the function has to be redeployed after every change to the code.

Google’s documentation

for local development of Google Cloud Functions is somewhat simplistic and difficult to follow in places. Therefore here are my instructions for C#


Download dotnet-sdk-3.1

dotnet new --install Google.Cloud.Functions.Templates

dotnet new gcf-http

The project gets the name of the parent folder

Local with Functions Framework


dotnet run

Local with Docker / Cloud Native Buildpacks

Install ‚pack‘:

Create Docker image:

pack build --builder --env GOOGLE_RUNTIME=dotnet --env GOOGLE_FUNCTION_SIGNATURE_TYPE=http --env GOOGLE_FUNCTION_TARGET=TestGcpLocalCloudFunction01.Function test-gpc-local-function-01

TestGcpLocalCloudFunction01 is the name of the project / namespace in C#. Function is the name of the class.

It is essential to note that the name of the image test-gpc-local-function-01 is lowercase.