Google Cloud Functions: Node.js Client

release level npm version

Functions client for Node.js

A comprehensive list of changes in each version may be found in the CHANGELOG.

Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.

Table of contents:


Before you begin

  1. Select or create a Cloud Platform project.
  2. Enable the Google Cloud Functions API.
  3. Set up authentication with a service account so you can access the API from your local workstation.

Installing the client library

npm install @google-cloud/functions

Using the client library

// Imports the Google Cloud client library

// remove this line after package is released
// eslint-disable-next-line node/no-missing-require
const {CloudFunctionsServiceClient} = require('@google-cloud/functions');

// TODO(developer): replace with your prefered project ID.
// const projectId = 'my-project'

// Creates a client
const client = new CloudFunctionsServiceClient();

// project = 'my-project/*/locations/*' // Get the functions for a project.
async function listFunctions() {
  const [functions] = await client.listFunctions({
    parent: `projects/${projectId}/locations/-`,


Samples are in the samples/ directory. Each sample's has instructions for running its sample.

SampleSource CodeTry it
Cloud_functions_service.call_functionsource codeOpen in Cloud Shell
Cloud_functions_service.create_functionsource codeOpen in Cloud Shell
Cloud_functions_service.delete_functionsource codeOpen in Cloud Shell
Cloud_functions_service.generate_download_urlsource codeOpen in Cloud Shell
Cloud_functions_service.generate_upload_urlsource codeOpen in Cloud Shell
Cloud_functions_service.get_functionsource codeOpen in Cloud Shell
Cloud_functions_service.get_iam_policysource codeOpen in Cloud Shell
Cloud_functions_service.list_functionssource codeOpen in Cloud Shell
Cloud_functions_service.set_iam_policysource codeOpen in Cloud Shell