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

Package detail

@google-cloud/run

googleapis5.6mApache-2.02.1.0TypeScript support: included

Cloud Run Admin API

secrets, secret, secret manager, secrets management, gcp, google, cloud

readme

Google Cloud Platform logo

Cloud Run: Node.js Client

release level npm version

Cloud Run Admin API

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 billing for your project.
  3. Enable the Cloud Run API.
  4. Set up authentication so you can access the API from your local workstation.

Installing the client library

npm install @google-cloud/run

Using the client library

/**
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The location and project to list resources on.
 *  Location must be a valid GCP region, and may not be the "-" wildcard.
 *  Format: projects/{projectnumber}/locations/{location}
 */
// const parent = 'abc123'
/**
 *  Maximum number of Services to return in this call.
 */
// const pageSize = 1234
/**
 *  A page token received from a previous call to ListServices.
 *  All other parameters must match.
 */
// const pageToken = 'abc123'

/**
 *  If true, returns deleted (but unexpired) resources along with active ones.
 */
// const showDeleted = true
// Imports the Run library
const {ServicesClient} = require('@google-cloud/run').v2;

// Instantiates a client
const runClient = new ServicesClient();

async function callListServices() {
  // Construct request
  const request = {
    parent,
  };

  // Run request
  const iterable = await runClient.listServicesAsync(request);
  for await (const response of iterable) {
    console.log(response);
  }
}

callListServices();

Samples

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

Sample Source Code Try it
Builds.submit_build source code Open in Cloud Shell
Executions.cancel_execution source code Open in Cloud Shell
Executions.delete_execution source code Open in Cloud Shell
Executions.get_execution source code Open in Cloud Shell
Executions.list_executions source code Open in Cloud Shell
Jobs.create_job source code Open in Cloud Shell
Jobs.delete_job source code Open in Cloud Shell
Jobs.get_iam_policy source code Open in Cloud Shell
Jobs.get_job source code Open in Cloud Shell
Jobs.list_jobs source code Open in Cloud Shell
Jobs.run_job source code Open in Cloud Shell
Jobs.set_iam_policy source code Open in Cloud Shell
Jobs.test_iam_permissions source code Open in Cloud Shell
Jobs.update_job source code Open in Cloud Shell
Revisions.delete_revision source code Open in Cloud Shell
Revisions.get_revision source code Open in Cloud Shell
Revisions.list_revisions source code Open in Cloud Shell
Services.create_service source code Open in Cloud Shell
Services.delete_service source code Open in Cloud Shell
Services.get_iam_policy source code Open in Cloud Shell
Services.get_service source code Open in Cloud Shell
Services.list_services source code Open in Cloud Shell
Services.set_iam_policy source code Open in Cloud Shell
Services.test_iam_permissions source code Open in Cloud Shell
Services.update_service source code Open in Cloud Shell
Tasks.get_task source code Open in Cloud Shell
Tasks.list_tasks source code Open in Cloud Shell
Quickstart source code Open in Cloud Shell

The Cloud Run 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/run@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

2.1.0 (2025-05-20)

Features

  • [run] support GPU zonal redundancy setting in Cloud Run services (#6349) (350da9c)

2.0.1 (2025-03-19)

Bug Fixes

  • [Many APIs] await/catch promises, and update listOperationsAsync return type (#6188) (a73cdbf)

2.0.0 (2025-03-18)

⚠ BREAKING CHANGES

  • upgrade to Node 18 (#6096)

Features

  • [Many APIs] add request/response debug logging to gapics (b99c5f8)

Miscellaneous Chores

1.5.1 (2025-02-12)

Bug Fixes

  • [run] finalize fixing typings for headers in generator (#6016) (34bda26)

1.5.0 (2024-11-21)

Features

  • [run]support manual instance count in Cloud Run for manual scaling feature (#5821) (a1ab492)

1.4.0 (2024-07-22)

Features

  • [run]support update_mask in Cloud Run UpdateService (#5532) (62bc6bf)

1.3.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 (#5354) (a9784ed)

1.2.0 (2024-04-05)

Features

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

1.1.0 (2024-02-09)

Features

  • Trusted Private Cloud support, use the universeDomain parameter (#5027) (88763bb)

1.0.2 (2023-10-18)

Bug Fixes

  • [run] Removes accidentally exposed field service.traffic_tags_cleanup_threshold in Cloud Run Service (#4697) (e63c060)

1.0.1 (2023-09-06)

Bug Fixes

  • [Many APIs] simplify logic for HTTP/1.1 REST fallback option (#4587) (e3b1e7e)

1.0.0 (2023-08-06)

⚠ BREAKING CHANGES

  • migrate to Node 14 (#4443)

Bug Fixes

Miscellaneous Chores

0.6.0 (2023-07-11)

Features

0.5.0 (2023-05-04)

Features

  • [run] Adds support for Startup CPU Boost (GA) (#4220) (b1b4e29)

0.4.2 (2023-04-13)

Bug Fixes

0.4.1 (2023-02-15)

Bug Fixes

  • [Many APIs] changing format of the jsdoc links (#3989) (95399f7)

0.4.0 (2023-01-28)

Features

  • Added SuggestConversationSummary RPC (#3853) (cc352db)
  • Adding support for encryption_key_revocation_action and encryption_key_shutdown_duration for RevisionTemplate and ExecutionTemplate (#3874) (4693692)

0.3.0 (2023-01-06)

Features

  • Adds Cloud Run Jobs v2 API client libraries (d2f1501)
  • Adds gRPC probe support to Cloud Run v2 API client libraries (d2f1501)
  • Adds Startup and Liveness probes to Cloud Run v2 API client libraries (d2f1501)

Bug Fixes

  • deps: Use google-gax v3.5.2 (#33) (c6eef9a)
  • Regenerated protos JS and TS definitions (#37) (2f1d253)

0.2.3 (2022-09-14)

Bug Fixes

  • Allow passing gax instance to client constructor (#24) (91e2ac5)
  • Do not import the whole google-gax from proto JS (#1553) (#23) (acda49f)
  • Preserve default values in x-goog-request-params header (#26) (debc1eb)
  • use google-gax v3.3.0 (acda49f)

0.2.2 (2022-08-23)

Bug Fixes

0.2.1 (2022-07-20)

Bug Fixes

0.2.0 (2022-07-04)

Features

0.1.1 (2022-06-02)

Bug Fixes

  • fixes for dynamic routing and streaming descriptors (#4) (ba3c84a)

0.1.0 (2022-05-20)

Features

  • initial generation of library (#1) (2dc373a)
  • initial stub of library (b283d51)