Local functions development

Cloud Run functions supports several methods of running your functions outside of the target deployment environment. This is particularly useful for iterative development, and for situations where you want to test your function before deploying.

The ability to run your functions without deploying them can simplify local testing, compliance with data locality restrictions, and multicloud deployments:

  • Data locality restrictions: Test your function locally without accessing production data, to avoid violating your organization's data locality rules.

  • Multicloud deployments: Multicloud function deployments are an established pattern to mitigate downtime risk in reliability-critical environments. Deploying functions to environments other than Cloud Run functions itself reduces the risk of your application experiencing unplanned downtime.

Develop functions locally using Functions Framework

You can develop and test functions locally using Functions Framework. Developing a function locally can help you test your code without having to rebuild your function container. This can save time and make it easier to test your function.

Cloud Run uses the open-source Functions Framework libraries to wrap your deployed functions in a persistent HTTP application.

The Functions Framework can also run on any other platform that supports the language itself, including your local machine, on-premises servers, and Compute Engine.

Install dependencies

In your function's directory, install the Functions Framework library for your language: