Running and debugging Google Cloud functions locally
Impersonate the service account, connect to Google Cloud services, set up automatic reloading and forget about manual restarts, inspect objects and set breakpoints in DevTools
What are Google Cloud Run functions?
Google Cloud function is a code that runs only when it is needed. Cloud functions can handle HTTP requests, listen to events in the Google Cloud or be scheduled. With little additional code, Cloud functions can use any Google Cloud and Google workspace services and can be secured.
However, the extensive capabilities of the Google Cloud sometimes make its documentation challenging to navigate. In this post I summarize the techniques useful for development and debugging of HTTP-cloud functions on a local computer. Specifically I discuss:
- hot reloading, which is poorly documented
- debugging with DevTools, which is also poorly documented
- using a Google account or a service account as the credentials to be used by Google Cloud libraries. Which is the easier option?
The ease of securing cloud functions and authenticating users I illustrated in earlier posts.