Function Store
  • Home
  • Getting started
    • Introduction
    • Installing a function
    • Reconfiguring a function
    • Uninstalling a function
    • FAQs
  • Reference
    • Requirements
      • Assign Roles
        • User permissions
      • Link a Billing account to your project
      • Enable the APIs
    • Projects
      • How to add a project
      • How to set up a project
    • Functions
      • Benefits
      • Use cases
      • Authentication when installing
      • Runtime configuration
      • Deploying with a ZIP file
    • Policies
      • How to add a Policy
      • How to remove a Policy
    • Authentication
      • Users
      • Roles
      • Permissions
    • Secrets
      • Creating a Secret
      • Using a Secret
      • Changing the value for a Secret
      • Deactivating a Secret
  • developers
    • Overview
    • Getting Started
    • Set up
    • Workspaces
      • Create a workspace
      • Workspace boilerplate
      • Node engines
    • Writing Functions
      • Function Anatomy
      • Configuration file
      • Function Triggers
      • Environment Variables
        • Type "text"
        • Type "number"
        • Type "email"
        • Type "url"
        • Type "json"
        • Type "boolean"
        • Type "select"
        • Type "multiselect"
        • Type "firestoreDocumentPath"
        • Type "firestoreCollectionPath"
        • Type "color"
      • Documentation
    • Push/Update your functions in the cloud
    • Continuous Integration
    • Publish functions in the Marketplace
    • Emulators
      • Initialize emulators in your workspace
      • Environment variables
      • Starting emulators
      • Testing your functions in the emulator
      • Importing existing data into local emulators
        • Exporting data from Cloud Firestore to local emulator
        • Exporting user accounts from Firebase to local emulator
    • Visual Studio Code Extension
      • Installing the extension
      • Extension UI
      • Functions list
      • Creating and editing functions
      • Emulators
      • Extension settings
      • Troubleshooting
        • "Command not found" error when executing a command
  • Billing
    • Understanding Billing
  • Security
    • Security
  • Resources
    • Events and Triggers
    • Best Practices
      • How to log events in functions?
    • Document your Functions
    • Editorial guidelines
    • Our Processes
      • Use Cases Analysis
  • Use cases
    • Custom Stripe Checkout
Powered by GitBook
On this page
  • Overview
  • Steps to install with a ZIP file
  • Step 1: Go to GCP
  • Step 2: Select the project to which you want to install the ZIP
  • Step 3: Create a function
  • Step 4: Name your function and select a region
  • Step 5: In the Trigger field, select the trigger type HTTP
  • Step 6: Open the Runtime, build, connections and security settings to add environment variables
  • Step 7: Click Next
  • Step 8: Download the ZIP file
  • Step 9: In the Source code field, select ZIP upload
  • Step 10: Click Browse in the Stage bucket field to select a staging bucket
  • Step 11: Click Deploy

Was this helpful?

  1. Reference
  2. Functions

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.

PreviousRuntime configurationNextPolicies

Last updated 3 years ago

Was this helpful?

Overview

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.

This video guides you through the process of installing a function manually in GCP by uploading a ZIP file.
Environment variables of an HTTPS function