Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@google-cloud/functions

googleapis154.7kApache-2.03.6.1TypeScript support: included

Functions client for Node.js

google apis client, google api client, google apis, google api, google, google cloud platform, google cloud, cloud, google functions, functions, cloud functions service

readme

Google Cloud Platform logo

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:

Quickstart

Before you begin

  1. Select or create a Cloud Platform project.
  2. Enable the Google Cloud Functions API.
  3. Set up authentication 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/-`,
  });
  console.info(functions);
}
listFunctions();

Samples

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

Sample Source Code Try it
Cloud_functions_service.call_function source code Open in Cloud Shell
Cloud_functions_service.create_function source code Open in Cloud Shell
Cloud_functions_service.delete_function source code Open in Cloud Shell
Cloud_functions_service.generate_download_url source code Open in Cloud Shell
Cloud_functions_service.generate_upload_url source code Open in Cloud Shell
Cloud_functions_service.get_function source code Open in Cloud Shell
Cloud_functions_service.get_iam_policy source code Open in Cloud Shell
Cloud_functions_service.list_functions source code Open in Cloud Shell
Cloud_functions_service.set_iam_policy source code Open in Cloud Shell
Cloud_functions_service.test_iam_permissions source code Open in Cloud Shell
Cloud_functions_service.update_function source code Open in Cloud Shell
Function_service.create_function source code Open in Cloud Shell
Function_service.delete_function source code Open in Cloud Shell
Function_service.generate_download_url source code Open in Cloud Shell
Function_service.generate_upload_url source code Open in Cloud Shell
Function_service.get_function source code Open in Cloud Shell
Function_service.list_functions source code Open in Cloud Shell
Function_service.list_runtimes source code Open in Cloud Shell
Function_service.update_function source code Open in Cloud Shell
Function_service.create_function source code Open in Cloud Shell
Function_service.delete_function source code Open in Cloud Shell
Function_service.generate_download_url source code Open in Cloud Shell
Function_service.generate_upload_url source code Open in Cloud Shell
Function_service.get_function source code Open in Cloud Shell
Function_service.list_functions source code Open in Cloud Shell
Function_service.list_runtimes source code Open in Cloud Shell
Function_service.update_function source code Open in Cloud Shell
Function_service.create_function source code Open in Cloud Shell
Function_service.delete_function source code Open in Cloud Shell
Function_service.generate_download_url source code Open in Cloud Shell
Function_service.generate_upload_url source code Open in Cloud Shell
Function_service.get_function source code Open in Cloud Shell
Function_service.list_functions source code Open in Cloud Shell
Function_service.list_runtimes source code Open in Cloud Shell
Function_service.update_function source code Open in Cloud Shell
Quickstart source code Open in Cloud Shell

The Google Cloud Functions Node.js Client API Reference documentation also contains samples.

Supported Node.js Versions

Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js. If you are using an end-of-life version of Node.js, we recommend that you update as soon as possible to an actively supported LTS version.

Google's client libraries support legacy versions of Node.js runtimes on a best-efforts basis with the following warnings:

  • Legacy versions are not tested in continuous integration.
  • Some security patches and features cannot be backported.
  • Dependencies cannot be kept up-to-date.

Client libraries targeting some end-of-life versions of Node.js are available, and can be installed through npm dist-tags. The dist-tags follow the naming convention legacy-(version). For example, npm install @google-cloud/functions@legacy-8 installs client libraries for versions compatible with Node.js 8.

Versioning

This library follows Semantic Versioning.

This library is considered to be stable. The code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with an extensive deprecation period. Issues and requests against stable libraries are addressed with the highest priority.

More Information: Google Cloud Platform Launch Stages

Contributing

Contributions welcome! See the Contributing Guide.

Please note that this README.md, the samples/README.md, and a variety of configuration files in this repository (including .nycrc and tsconfig.json) are generated from a central template. To edit one of these files, make an edit to its templates in directory.

License

Apache Version 2.0

See LICENSE

changelog

Changelog

3.6.1 (2025-02-12)

Bug Fixes

  • [Many APIs] finalize fixing typings for headers in generator (#6013) (cd3a2d4)

3.6.0 (2024-08-19)

Features

3.5.0 (2024-08-09)

Features

3.4.0 (2024-05-21)

Features

  • [Many APIs] update Nodejs generator to send API versions in headers for GAPICs (#5351) (01f48fc)
  • [Many APIs] update Nodejs generator to send API versions in headers for GAPICs (#5353) (1a2388d)
  • [Many APIs] update Nodejs generator to send API versions in headers for GAPICs (#5354) (a9784ed)

3.3.0 (2024-04-16)

Features

  • [Many APIs] add several fields to manage state of database encryption update (#5188) (c5ccdf9)

3.2.0 (2024-02-09)

Features

  • Trusted Private Cloud support, use the universeDomain parameter (#5025) (7244cab)

3.1.0 (2024-02-07)

Features

  • [functions] updated description for docker_registry to reflect transition to Artifact Registry (#4981) (a65c238)

3.0.1 (2023-09-06)

Bug Fixes

  • [Many APIs] simplify logic for HTTP/1.1 REST fallback option (#4586) (4b18686)

3.0.0 (2023-08-06)

⚠ BREAKING CHANGES

  • migrate to Node 14 (#4443)

Bug Fixes

Miscellaneous Chores

2.5.0 (2023-06-06)

Features

  • [functions] ListFunctions now include metadata which indicates whether a function is a GEN_1 or GEN_2 function (#4262) (b6d8778)

2.4.1 (2023-04-13)

Bug Fixes

2.4.0 (2023-03-28)

Features

2.3.1 (2023-02-15)

Bug Fixes

  • [Many APIs] changing format of the jsdoc links (#3987) (07043a6)

2.3.0 (2023-01-28)

Features

2.2.3 (2022-11-11)

Bug Fixes

2.2.2 (2022-09-21)

Bug Fixes

  • Preserve default values in x-goog-request-params header (#187) (57b025c)

2.2.1 (2022-09-01)

Bug Fixes

2.2.0 (2022-07-14)

Features

  • generating GAPIC libraries for Google Cloud Functions v2beta (#175) (63a2cfd)
  • support regapic LRO (#172) (eb5486d)

2.1.0 (2022-06-20)

Features

  • added support for CMEK (#166) (5f5e7e0)
  • generating GAPIC libraries for Google Cloud Functions v2alpha (25c6047)
  • generating GAPIC libraries for Google Cloud Functions v2beta (#171) (25c6047)

2.0.0 (2022-05-17)

⚠ BREAKING CHANGES

  • update library to use Node 12 (#164)

Build System

1.3.0 (2022-04-21)

Features

1.2.0 (2021-09-16)

Features

  • add SecurityLevel option on HttpsTrigger (#110) (13d865e)
  • turns on self-signed JWT feature flag (#106) (9fb2982)

1.1.9 (2021-08-17)

Bug Fixes

  • build: migrate to using main branch (#103) (e1955e9)
  • deps: google-gax v2.24.1 (#104) (a419fa4)
  • updating behavior of source_upload_url during Get/List function calls (#100) (2cb3abe)

1.1.8 (2021-07-21)

Bug Fixes

  • Updating WORKSPACE files to use the newest version of the Typescript generator. (#93) (6125f4f)

1.1.7 (2021-07-12)

Bug Fixes

1.1.6 (2021-06-24)

Bug Fixes

  • make request optional in all cases (#85) (16b60eb)

1.1.5 (2021-06-07)

Bug Fixes

  • GoogleAdsError missing using generator version after 1.3.0 (#78) (4c413d8)

1.1.4 (2021-05-12)

Bug Fixes

  • deps: require google-gax v2.12.0 (#70) (0369f0c)
  • use require() to load JSON protos (#73) (b3da62e)

1.1.3 (2021-03-15)

Bug Fixes

  • fix service namespace in grpc_service_config. (#56) (8f5af4a)

1.1.2 (2020-11-25)

Bug Fixes

  • browser: check for fetch on window (0aa94fa)

1.1.1 (2020-11-06)

Bug Fixes

  • do not modify options object, use defaultScopes (#38) (24738f1)

1.1.0 (2020-09-01)

Features

1.0.1 (2020-08-03)

Bug Fixes

  • run synthtool hack to compile code (#6) (2b080c5)

1.0.0 (2020-07-24)

⚠ BREAKING CHANGES

  • initial generation of full library

Features

Bug Fixes