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

Package detail

@google-cloud/tasks

googleapis1.5mApache-2.06.0.1TypeScript support: included

Cloud Tasks API client for Node.js

google apis client, google api client, google apis, google api, google, google cloud platform, google cloud, cloud, google cloud-tasks, cloud-tasks, Cloud Tasks API

readme

Google Cloud Platform logo

Cloud Tasks: Node.js Client

release level npm version

Cloud Tasks API 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 billing for your project.
  3. Enable the Cloud Tasks API.
  4. 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/tasks

Samples

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

Sample Source Code Try it
Cloud_tasks.create_queue source code Open in Cloud Shell
Cloud_tasks.create_task source code Open in Cloud Shell
Cloud_tasks.delete_queue source code Open in Cloud Shell
Cloud_tasks.delete_task source code Open in Cloud Shell
Cloud_tasks.get_iam_policy source code Open in Cloud Shell
Cloud_tasks.get_queue source code Open in Cloud Shell
Cloud_tasks.get_task source code Open in Cloud Shell
Cloud_tasks.list_queues source code Open in Cloud Shell
Cloud_tasks.list_tasks source code Open in Cloud Shell
Cloud_tasks.pause_queue source code Open in Cloud Shell
Cloud_tasks.purge_queue source code Open in Cloud Shell
Cloud_tasks.resume_queue source code Open in Cloud Shell
Cloud_tasks.run_task source code Open in Cloud Shell
Cloud_tasks.set_iam_policy source code Open in Cloud Shell
Cloud_tasks.test_iam_permissions source code Open in Cloud Shell
Cloud_tasks.update_queue source code Open in Cloud Shell
Cloud_tasks.acknowledge_task source code Open in Cloud Shell
Cloud_tasks.buffer_task source code Open in Cloud Shell
Cloud_tasks.cancel_lease source code Open in Cloud Shell
Cloud_tasks.create_queue source code Open in Cloud Shell
Cloud_tasks.create_task source code Open in Cloud Shell
Cloud_tasks.delete_queue source code Open in Cloud Shell
Cloud_tasks.delete_task source code Open in Cloud Shell
Cloud_tasks.get_iam_policy source code Open in Cloud Shell
Cloud_tasks.get_queue source code Open in Cloud Shell
Cloud_tasks.get_task source code Open in Cloud Shell
Cloud_tasks.lease_tasks source code Open in Cloud Shell
Cloud_tasks.list_queues source code Open in Cloud Shell
Cloud_tasks.list_tasks source code Open in Cloud Shell
Cloud_tasks.pause_queue source code Open in Cloud Shell
Cloud_tasks.purge_queue source code Open in Cloud Shell
Cloud_tasks.renew_lease source code Open in Cloud Shell
Cloud_tasks.resume_queue source code Open in Cloud Shell
Cloud_tasks.run_task source code Open in Cloud Shell
Cloud_tasks.set_iam_policy source code Open in Cloud Shell
Cloud_tasks.test_iam_permissions source code Open in Cloud Shell
Cloud_tasks.update_queue source code Open in Cloud Shell
Cloud_tasks.upload_queue_yaml source code Open in Cloud Shell
Cloud_tasks.buffer_task source code Open in Cloud Shell
Cloud_tasks.create_queue source code Open in Cloud Shell
Cloud_tasks.create_task source code Open in Cloud Shell
Cloud_tasks.delete_queue source code Open in Cloud Shell
Cloud_tasks.delete_task source code Open in Cloud Shell
Cloud_tasks.get_iam_policy source code Open in Cloud Shell
Cloud_tasks.get_queue source code Open in Cloud Shell
Cloud_tasks.get_task source code Open in Cloud Shell
Cloud_tasks.list_queues source code Open in Cloud Shell
Cloud_tasks.list_tasks source code Open in Cloud Shell
Cloud_tasks.pause_queue source code Open in Cloud Shell
Cloud_tasks.purge_queue source code Open in Cloud Shell
Cloud_tasks.resume_queue source code Open in Cloud Shell
Cloud_tasks.run_task source code Open in Cloud Shell
Cloud_tasks.set_iam_policy source code Open in Cloud Shell
Cloud_tasks.test_iam_permissions source code Open in Cloud Shell
Cloud_tasks.update_queue source code Open in Cloud Shell
Quickstart source code Open in Cloud Shell

The Cloud Tasks 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/tasks@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

npm history

6.0.1 (2025-03-19)

Bug Fixes

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

6.0.0 (2025-03-18)

⚠ BREAKING CHANGES

  • migrate tasks to node 18 (#6123)
  • upgrade to Node 18 (#6096)

Features

  • Add request/response debug logging to gapics, update templates to gax 5 and node 18 (#1671) (eed00f4)

Bug Fixes

  • Add json files to tsconfig templates (#1692) (ba6be1d) (eed00f4)

Miscellaneous Chores

5.5.2 (2024-12-18)

Bug Fixes

5.5.1 (2024-10-10)

Bug Fixes

5.5.0 (2024-07-22)

Features

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

5.3.0 (2024-03-29)

Features

  • [Many APIs] add several fields to manage state of database encryption update (#5191) (57567db)

5.2.1 (2024-03-26)

Bug Fixes

  • [tasks] issue with ambiguous naming in protos (#5173) (28e1ffd)

5.2.0 (2024-03-23)

Features

5.1.1 (2024-02-27)

Bug Fixes

  • [tasks] Add client library version to headers (#5083) (411e8eb)

5.1.0 (2024-02-09)

Features

  • Trusted Private Cloud support, use the universeDomain parameter (#5028) (852f3eb)

5.0.0 (2024-01-29)

⚠ BREAKING CHANGES

  • [tasks] publish in ESM and CJS, and remove bufferTask (#4952)

Features

  • [tasks] publish in ESM and CJS, and remove bufferTask (#4952) (2aa0e2e)

4.1.0 (2023-11-30)

Features

  • [tasks] publish cloud tasks in esm and cjs (#4720) (6773a05)

4.0.1 (2023-09-06)

Bug Fixes

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

4.0.0 (2023-08-06)

⚠ BREAKING CHANGES

  • migrate to Node 14 (#4443)

Bug Fixes

Miscellaneous Chores

3.2.0 (2023-07-24)

Features

  • [tasks] increase timeout of RPC methods to 20s for v2 (#4425) (dcb6f87)

3.1.2 (2023-04-13)

Bug Fixes

3.1.1 (2023-02-15)

Bug Fixes

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

3.1.0 (2023-01-28)

Features

3.0.5 (2022-11-10)

Bug Fixes

3.0.4 (2022-09-22)

Bug Fixes

  • issue-640: Adding headers in task request samples (#642) (d334d0d)
  • Preserve default values in x-goog-request-params header (#657) (feb5188)
  • Wrapping param inSeconds with parseInt to ensure correct addition (#655) (efdb0b8)

3.0.3 (2022-09-01)

Bug Fixes

  • Allow passing gax instance to client constructor (#650) (f26f795)
  • Do not import the whole google-gax from proto JS (#1553) (#649) (6802824)

3.0.2 (2022-08-23)

Bug Fixes

3.0.1 (2022-06-30)

Bug Fixes

3.0.0 (2022-06-07)

⚠ BREAKING CHANGES

  • update library to use Node 12 (#625)

Build System

2.6.0 (2022-05-06)

Features

2.5.0 (2021-12-09)

Features

2.4.2 (2021-09-10)

Bug Fixes

2.4.1 (2021-09-07)

Bug Fixes

2.4.0 (2021-09-07)

Features

  • turns on self-signed JWT feature flag (#561) (9fde4fe)

2.3.6 (2021-07-16)

Bug Fixes

  • Updating WORKSPACE files to use the newest version of the Typescript generator. (#549) (96c505e)

2.3.5 (2021-07-12)

Bug Fixes

2.3.4 (2021-06-30)

Bug Fixes

2.3.3 (2021-06-30)

Bug Fixes

2.3.2 (2021-05-25)

Bug Fixes

  • GoogleAdsError missing using generator version after 1.3.0 (#529) (760c204)

2.3.1 (2021-05-12)

Bug Fixes

2.3.0 (2021-01-22)

Features

  • introducing fields: ListQueuesRequest.read_mask, GetQueueRequest .read_mask, Queue.task_ttl, Queue.tombstone_ttl, Queue.stats and introducing messages: QueueStats (#499) (d04ef73)

2.2.0 (2021-01-09)

Features

Bug Fixes

2.1.3 (2020-11-25)

Bug Fixes

  • browser: check for fetch on window (6abe685)
  • do not modify options object, use defaultScopes (#484) (039becb)

2.1.2 (2020-10-27)

Bug Fixes

  • samples: region tag collided with tasks-api (#476) (fd73aa4)

2.1.1 (2020-09-12)

Bug Fixes

  • deps: update dependency yargs to v16 (#460) (7d24cda)

2.1.0 (2020-07-06)

Features

  • introducing field Queue.type docs: fixing typos and minor updates (#426) (d0c538c)

Bug Fixes

2.0.1 (2020-06-12)

Bug Fixes

  • handle fallback option properly (#425) (0d4e8c9)
  • regen protos and tests, formatting (#413) (b05145e)
  • remove eslint, update gax, fix generated protos, run the generator (#400) (45a3425)
  • remove unused files from package (#404) (803bc49)
  • synth.py clean up for multiple version (#415) (b860452)

2.0.0 (2020-04-07)

⚠ BREAKING CHANGES

  • The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM.

New feature: methods with pagination now support async iteration.

Features

  • drop node8 support, support for async iterators (#388) (2b759e1)

Bug Fixes

  • export explicit version in protos.js (#393) (5b8c80d)

1.9.0 (2020-03-06)

Features

1.8.0 (2020-02-29)

Features

  • add StackdriverLoggingConfig field to Cloud Tasks v2 API (db2397a)
  • export protos in src/index.ts (a27e213)

1.7.3 (2020-02-07)

Bug Fixes

  • pass x-goog-request-params header for streaming calls (ba267cc)

1.7.2 (2020-01-28)

Bug Fixes

  • enum, bytes, and Long types now accept strings (58aa504)

1.7.1 (2020-01-09)

Bug Fixes

1.7.0 (2020-01-05)

Features

  • move library to typescript code generation (#317) (7dda287)

Bug Fixes

  • deps: pin TypeScript below 3.7.0 (124594b)

1.6.1 (2019-11-18)

Bug Fixes

  • deps: update dependency yargs to v15 (#308) (90d3a71)

1.6.0 (2019-11-13)

Features

  • introduces HTTP targets to default v2 API (#300) (6dad421)

Bug Fixes

  • docs: snippets are now replaced in jsdoc comments (#304) (741e8ab)
  • import long into proto ts declaration file (#305) (dd1fcd1)

1.5.1 (2019-10-22)

Bug Fixes

1.5.0 (2019-10-03)

Bug Fixes

  • update paths in resource reference options (#284) (13b5db0)
  • use compatible version of google-gax (d6cae4e)
  • docs: use long names when class names collide (#290) (0215af8)

Features

1.4.0 (2019-09-16)

Features

  • load protos from JSON, grpc-fallback support (1c735c3)

1.3.0 (2019-08-28)

Bug Fixes

  • deps: update dependency yargs to v14 (d959ff7)
  • docs: stop linking reference documents to anchor (06f8c26)

Features

  • switch to cloudtasks.googleapis.com default host (#268) (4f4c66b)

1.2.1 (2019-08-05)

Bug Fixes

  • allow calls with no request, add JSON proto (01198ea)

1.2.0 (2019-07-02)

Features

1.1.2 (2019-06-26)

Bug Fixes

  • docs: link to reference docs section on googleapis.dev (#250) (a35d76c)

1.1.1 (2019-06-14)

Bug Fixes

1.1.0 (2019-06-05)

Features

  • support apiEndpoint override in client constructor (#239) (5bb4eff)

1.0.0 (2019-05-13)

Bug Fixes

  • DEADLINE_EXCEEDED retry code is idempotent (#219) (59cfd36)
  • deps: update dependency google-gax to v1 (#218) (25d0317)
  • DEADLINE_EXCEEDED no longer treated as idempotent and retried (739a515)
  • deps: update dependency google-gax to ^0.26.0 (#207) (7492ae3)

Build System

BREAKING CHANGES

  • upgrade engines field to >=8.10.0 (#209)

v0.5.0

03-21-2019 22:39 PDT

This release has breaking changes. The default version of the API has changed from v2beta3 to v2. Potential breaking changes may apply.

New Features

  • feat: add v2 of the tasks API (#192)

Internal / Testing Changes

  • chore: publish to npm using wombat (#189)
  • build: use per-repo publish token (#188)
  • refactor: update json import paths (#186)
  • build: Add docuploader credentials to node publish jobs (#184)

v0.4.0

03-06-2019 13:30 PST

New Features

  • feat: add alpha support for HTTP triggers (#177)

Bug fixes

  • fix: throw on invalid credentials

Documentation

  • docs: update contributing path in README (#168)
  • docs: move CONTRIBUTING.md to root (#167)
  • docs: add lint/fix example to contributing guide (#165)
  • docs: fix example comments (#164)
  • docs: update comments on protos (#180)
  • docs: sync latest proto docs
  • docs: update README to include samples (#178)
  • docs: update links in contrib guide (#174)

Internal / Testing Changes

  • build: update release configuration
  • chore(deps): update dependency mocha to v6 (#176)
  • build: use linkinator for docs test (#173)
  • fix(deps): update dependency yargs to v13 (#171)
  • build: create docs test npm scripts (#170)
  • build: test using @grpc/grpc-js in CI (#169)
  • refactor: improve generated code style. (#163)

v0.3.0

01-31-2019 23:06 PST

Implementation Changes

  • chore: adjust grpc timeout settings

New Features

  • feat: support the .dispatch_deadline property. (#160)

Dependencies

  • fix(deps): update dependency google-gax to ^0.25.0 (#161)
  • fix(deps): update dependency google-gax to ^0.24.0 (#158)
  • fix(deps): update dependency google-gax to ^0.23.0 (#154)
  • fix(deps): update dependency google-gax to ^0.22.0 (#122)

Documentation

  • fix(docs): remove unused long running operations types
  • samples: add queue create and delete samples (#142)
  • docs: update readme badges (#133)
  • docs(samples): updated samples code to use async await (#129)
  • update tasks samples to support new api version (#83)

Internal / Testing Changes

  • chore(deps): update dependency eslint-config-prettier to v4 (#159)
  • build: check broken links in generated docs (#151)
  • chore(build): inject yoshi automation key (#149)
  • chore: update nyc and eslint configs (#148)
  • chore: fix publish.sh permission +x (#146)
  • fix(build): fix Kokoro release script (#145)
  • build: add Kokoro configs for autorelease (#144)
  • chore: always nyc report before calling codecov (#139)
  • chore: nyc ignore build/test by default (#138)
  • chore: clean up usage of prettier and eslint (#137)
  • chore: update license file (#135)
  • fix(build): fix system key decryption (#131)
  • chore: add synth.metadata
  • refactor(samples): convert sample tests from ava to mocha (#126)
  • chore: update eslintignore config (#121)
  • chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 (#119)
  • chore: drop contributors from multiple places (#118)
  • chore: use latest npm on Windows (#117)
  • chore: update CircleCI config (#115)
  • chore(deps): update dependency eslint-plugin-node to v8 (#109)
  • chore: update issue templates (#108)
  • chore: remove old issue template (#104)
  • build: run tests on node11 (#103)
  • chores(build): run codecov on continuous builds (#99)
  • chores(build): do not collect sponge.xml from windows builds (#100)
  • chore: update new issue template (#98)
  • chore(deps): update dependency sinon to v7 (#93)
  • build: fix codecov uploading on Kokoro (#94)
  • Update kokoro config (#90)
  • chore(deps): update dependency eslint-plugin-prettier to v3 (#89)
  • Update kokoro config (#87)
  • test: remove appveyor config (#86)
  • Update the CI config (#85)
  • Enable prefer-const in the eslint config (#82)
  • Enable no-var in eslint (#81)
  • chore(deps): update dependency sinon to v6.3.3 (#79)
  • Switch to let/const (#80)

v0.2.2

Implementation Changes

This patch release reverts back to using v2beta3 as the default version. It also updates the samples.

  • feat: using v2beta3 by default

Documentation

  • Update Cloud Tasks Sample (#67)

Internal / Testing Changes

  • fix: replace service account key with Tasks access (#75)

v0.2.1

Implementation Changes

Samples for v2beta3 is pending and they won't work for v2beta2. We're temporarily reverting back to defaulting to v2beta2 when you import the library like so:

const cloudTasks = require('@google-cloud/tasks');
const client = new cloudTasks.CloudTasksClient(); // v2beta2 by default
  • feat: restoring v2beta2 by default (#71)

Dependencies

v0.20.0 fixes an issue with semver.

  • bump google-gax 0.20.0 (#69)

Documentation

  • add namespace to fix some 404s in doc (#66)

Internal / Testing Changes

  • Update CI config (#65)

v0.2.0

New Features

  • v2beta3 support for Node.js (#62)

Internal / Testing Changes

  • Retry npm install in CI (#63)

v0.1.1

Minor updates

  • fix(deps): update dependency google-gax to ^0.19.0 (#49)
  • fix(deps): update dependency google-gax to ^0.18.0 (#41)
  • Re-generate library using /synth.py (#55)

Docs

  • docs: update pull queue command (#30)
  • docs: updated gcloud command (#29)
  • Add Tasks Samples and Tests (#14)

Build & Test updates

  • Update the CI config (#52)
  • chore(deps): update dependency nyc to v13 (#53)
  • chore: update CircleCI config
  • chore(deps): update dependency eslint-config-prettier to v3 (#48)
  • chore: do not use npm ci (#47)
  • chore: ignore package-lock.json (#45)
  • chore: update renovate config (#43)
  • remove that whitespace (#42)
  • chore(deps): lock file maintenance (#40)
  • chore: move mocha options to mocha.opts (#39)
  • Re-generate library using /synth.py (#38)
  • Re-generate library using /synth.py (#35)
  • chore: add node templates to synth.py (#36)
  • fix: samples to require node>=8 (#37)
  • chore(deps): lock file maintenance (#34)
  • chore(deps): update dependency eslint-plugin-node to v7 (#32)
  • test: use strictEqual in tests (#33)
  • chore(deps): lock file maintenance (#31)
  • Upgrade repo-tools and regenerate scaffolding. (#27)
  • chore(deps): lock file maintenance (#25)
  • chore(deps): lock file maintenance (#24)
  • chore(deps): lock file maintenance (#23)
  • fix(deps): update dependency yargs to v12 (#22)
  • fix: update dependencies, run synth (#20)
  • Configure Renovate (#15)