Deploying with a ZIP file

This section contains the steps to install a function without granting your Google Cloud project permissions directly in Function Store and do it by downloading a ZIP file.


Function Store gives you alternatives to deploy a function:

  1. Directly into the app, with a project you previously set up. Then, in a few steps, you add the necessary information about the function and install it.

  2. Manually in GCP by uploading a ZIP file that includes all source files necessary for your function deployment, and following a considerable number of steps.

Although you need to go through more steps and a solid understanding of GCP is a must, manual installation with a ZIP file is an attractive option if:

  • You want to deploy your function without granting your GCP project permissions directly in Function Store.

  • You want to deeply understand the whole process that is running in the background.

Steps to install with a ZIP file

The following steps guide you through the process of installing a function manually in GCP by uploading a ZIP file. In this case, it's a trigger type HTTPS function named universalWebhook:

Step 1: Go to GCP

In the GCP Console, go to the Cloud Functions page.

Step 2: Select the project to which you want to install the ZIP

In the resource selector, select the project name or organization. Make sure that the project to which you want to install the ZIP is selected.

Step 3: Create a function

In the main content area, click the Create function button.

Step 4: Name your function and select a region

The name does not necessarily have to match the name of the Function Store function that you want to install.

Step 5: In the Trigger field, select the trigger type HTTP

In the Authentication field, select your desired authentication. If you want to create a public API, select the option Allow unauthenticated invocations. Otherwise, use the default settings to require authentication for your function. Click Save to save your changes.

Step 6: Open the Runtime, build, connections and security settings to add environment variables

In the Runtime environment variables, click the Add variable button. You must add the environment variables of the function.

The first one is the GCLOUD_PROJECT. Its value must be the current GCP project ID. Note that the project ID is not the name of the project. To make the process easier, the other environment variables you need are listed so you can copy and paste the name.

Step 7: Click Next

In the Runtime field, select the runtimeNode.js 10 for the function. In the Entry point field, write “handler” because this one is what the system uses by default.

Step 8: Download the ZIP file

Download the ZIP that contains all the elements of the function.

Step 9: In the Source code field, select ZIP upload

Click Browse in the ZIP file field to upload the function ZIP file from your local file system.

Step 10: Click Browse in the Stage bucket field to select a staging bucket

Your code will be staged in this Cloud Storage bucket as part of the deployment.

Step 11: Click Deploy

Your new function is listed on the Functions page. When the deployment is complete, a checkmark appears next to the function.

Note that some steps would change depending on the trigger type of the function, but don't worry, we have covered these changes in Function Store.

Last updated