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

Package detail

@google-cloud/pubsub

googleapis4.5mApache-2.04.9.0TypeScript support: included

Cloud Pub/Sub Client Library for Node.js

google apis client, google api client, google apis, google api, google, google cloud platform, google cloud, cloud, google pubsub, pubsub

readme

Google Cloud Platform logo

Google Cloud Pub/Sub: Node.js Client

release level npm version

Cloud Pub/Sub is a fully-managed real-time messaging service that allows you to send and receive messages between independent applications.

This document contains links to an API reference, samples, and other resources useful to developing Node.js applications. For additional help developing Pub/Sub applications, in Node.js and other languages, see our Pub/Sub quickstart, publisher, and subscriber guides.

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 Google Cloud Pub/Sub API.
  4. Set up authentication so you can access the API from your local workstation.

Installing the client library

npm install @google-cloud/pubsub

Using the client library

// Imports the Google Cloud client library
const {PubSub} = require('@google-cloud/pubsub');

async function quickstart(
  projectId = 'your-project-id', // Your Google Cloud Platform project ID
  topicNameOrId = 'my-topic', // Name for the new topic to create
  subscriptionName = 'my-sub' // Name for the new subscription to create
) {
  // Instantiates a client
  const pubsub = new PubSub({projectId});

  // Creates a new topic
  const [topic] = await pubsub.createTopic(topicNameOrId);
  console.log(`Topic ${topic.name} created.`);

  // Creates a subscription on that new topic
  const [subscription] = await topic.createSubscription(subscriptionName);

  // Receive callbacks for new messages on the subscription
  subscription.on('message', message => {
    console.log('Received message:', message.data.toString());
    process.exit(0);
  });

  // Receive callbacks for errors on the subscription
  subscription.on('error', error => {
    console.error('Received error:', error);
    process.exit(1);
  });

  // Send a message to the topic
  topic.publishMessage({data: Buffer.from('Test message!')});
}

Running gRPC C++ bindings

For some workflows and environments it might make sense to use the C++ gRPC implementation, instead of the default one (see: #770):

To configure @google-cloud/pubsub to use an alternative grpc transport:

  1. npm install grpc, adding grpc as a dependency.
  2. instantiate @google-cloud/pubsub with grpc:

    const {PubSub} = require('@google-cloud/pubsub');
    const grpc = require('grpc');
    const pubsub = new PubSub({grpc});

Samples

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

Sample Source Code Try it
Commit an Avro-Based Schema source code Open in Cloud Shell
Commit an Proto-Based Schema source code Open in Cloud Shell
Create an Avro based Schema source code Open in Cloud Shell
Create BigQuery Subscription source code Open in Cloud Shell
Create a Proto based Schema source code Open in Cloud Shell
Create Push Subscription source code Open in Cloud Shell
Create Push Subscription With No Wrapper source code Open in Cloud Shell
Create Subscription source code Open in Cloud Shell
Create a Cloud Storage subscription source code Open in Cloud Shell
Create Subscription With Dead Letter Policy source code Open in Cloud Shell
Create an exactly-once delivery subscription source code Open in Cloud Shell
Create Subscription With Filtering source code Open in Cloud Shell
Create Subscription with ordering enabled source code Open in Cloud Shell
Create Subscription With Retry Policy source code Open in Cloud Shell
Create Topic source code Open in Cloud Shell
Create Topic With Cloud Storage Ingestion source code Open in Cloud Shell
Create Topic With Kinesis Ingestion source code Open in Cloud Shell
Create Topic With Schema source code Open in Cloud Shell
Create Topic With Schema Revisions source code Open in Cloud Shell
Delete a previously created schema source code Open in Cloud Shell
Delete a Schema Revision source code Open in Cloud Shell
Delete Subscription source code Open in Cloud Shell
Delete Topic source code Open in Cloud Shell
Detach Subscription source code Open in Cloud Shell
Get a previously created schema source code Open in Cloud Shell
Get a previously created schema revision source code Open in Cloud Shell
Get Subscription source code Open in Cloud Shell
Get Subscription Policy source code Open in Cloud Shell
Get Topic Policy source code Open in Cloud Shell
List All Topics source code Open in Cloud Shell
List Revisions on a Schema source code Open in Cloud Shell
List schemas on a project source code Open in Cloud Shell
List Subscriptions source code Open in Cloud Shell
List Subscriptions On a Topic source code Open in Cloud Shell
Listen For Avro Records source code Open in Cloud Shell
Listen For Avro Records With Revisions source code Open in Cloud Shell
Listen For Errors source code Open in Cloud Shell
Listen For Messages source code Open in Cloud Shell
Listen with exactly-once delivery source code Open in Cloud Shell
Listen For Protobuf Messages source code Open in Cloud Shell
Listen For Messages With Custom Attributes source code Open in Cloud Shell
Subscribe with OpenTelemetry Tracing source code Open in Cloud Shell
Modify Push Configuration source code Open in Cloud Shell
Optimistic Subscribe source code Open in Cloud Shell
Publish Avro Records to a Topic source code Open in Cloud Shell
Publish Batched Messages source code Open in Cloud Shell
Publish Message source code Open in Cloud Shell
Publish Message With Custom Attributes source code Open in Cloud Shell
Publish Ordered Message source code Open in Cloud Shell
Publish Protobuf Messages to a Topic source code Open in Cloud Shell
Publish with flow control source code Open in Cloud Shell
Publish with OpenTelemetry Tracing source code Open in Cloud Shell
Publish With Retry Settings source code Open in Cloud Shell
Quickstart source code Open in Cloud Shell
Remove Dead Letter Policy source code Open in Cloud Shell
Resume Publish source code Open in Cloud Shell
Rollback a Schema source code Open in Cloud Shell
Set Subscription IAM Policy source code Open in Cloud Shell
Set Topic IAM Policy source code Open in Cloud Shell
Subscribe With Flow Control Settings source code Open in Cloud Shell
Synchronous Pull source code Open in Cloud Shell
Synchronous Pull with delivery attempt. source code Open in Cloud Shell
Synchronous Pull With Lease Management source code Open in Cloud Shell
Test Subscription Permissions source code Open in Cloud Shell
Test Topic Permissions source code Open in Cloud Shell
Update Dead Letter Policy source code Open in Cloud Shell
Update Topic Ingestion Type source code Open in Cloud Shell
Update Topic Schema source code Open in Cloud Shell
Validate a schema definition source code Open in Cloud Shell

The Google Cloud Pub/Sub 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/pubsub@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

4.9.0 (2024-11-12)

Features

  • Add IngestionFailureEvent to the external proto (#1984) (7075430)

Bug Fixes

4.8.0 (2024-10-15)

Features

  • Add ingestion Cloud Storage fields and Platform Logging fields to Topic (#1974) (afec9a1)
  • Return listing information for subscriptions created via Analytics Hub (afec9a1)

4.7.2 (2024-09-13)

Bug Fixes

4.7.1 (2024-08-26)

Bug Fixes

4.7.0 (2024-08-24)

Features

  • Add support for OTel context propagation and harmonized spans (#1833) (4b5c90d)

4.6.0 (2024-07-12)

Features

  • Add max messages batching for Cloud Storage subscriptions (#1956) (90546f6)
  • Add use_topic_schema for Cloud Storage Subscriptions (#1948) (120fa1b)

Bug Fixes

  • docs samples: Update missing argv in sample metadata for push subscription (#1946) (34b8c03)

4.5.0 (2024-06-11)

Features

  • Add service_account_email for export subscriptions (#1927) (c532854)

4.4.1 (2024-05-30)

Bug Fixes

  • An existing message UpdateVehicleLocationRequest is removed (5451d15)
  • An existing method SearchFuzzedVehicles is removed from service VehicleService (5451d15)
  • An existing method UpdateVehicleLocation is removed from service VehicleService (5451d15)
  • deps: Update dependency protobufjs to ~7.3.0 (#1921) (c5afd34)
  • Pull in new gax for protobufjs vuln fix (#1925) (8024c6d)

4.4.0 (2024-05-03)

Features

  • Add several fields to manage state of database encryption update (#1904) (aba9aee)

Bug Fixes

  • deps: Update dependency @types/long to v5 (#1901) (d13d395)

4.3.3 (2024-03-03)

Bug Fixes

4.3.2 (2024-02-13)

Bug Fixes

  • Update minimum google-gax versions for auth fixes (#1888) (08acade)

4.3.1 (2024-02-08)

Bug Fixes

  • Add option to manually control emulator auth handling, and fix heuristics for TPC (#1861) (761cdc8)

4.3.0 (2024-02-05)

Features

  • Trusted Private Cloud support, use the universeDomain parameter (#1878) (d89fd1d)

Bug Fixes

4.2.0 (2024-02-01)

Features

  • Add enforce_in_transit fields and optional annotations (#1873) (09fc424)
  • Add schema revision samples (#1870) (044e149)

Bug Fixes

  • deps: Update dependency @opentelemetry/semantic-conventions to ~1.20.0 (#1871) (2ee0dba)
  • deps: Update dependency @opentelemetry/semantic-conventions to ~1.21.0 (#1876) (0fe61a9)

4.1.1 (2024-01-05)

Bug Fixes

  • Correct long audio synthesis HTTP binding (#1867) (65940a4)
  • deps: Update dependency @opentelemetry/semantic-conventions to ~1.19.0 (#1862) (92259f5)

4.1.0 (2023-12-04)

Features

  • Add use_table_schema field to BigQueryConfig (#1858) (2875d83)

4.0.7 (2023-11-09)

Bug Fixes

  • deps: Update dependency @opentelemetry/semantic-conventions to ~1.18.0 (#1852) (d9a0432)
  • Set x-goog-request-params for streaming pull request (#1849) (7b82ff0)

4.0.6 (2023-09-15)

Bug Fixes

  • Bump the minimum gax up to 4.0.4 to get grpc-js fixes (#1829) (cc86e2b)
  • deps: Update dependency @opentelemetry/semantic-conventions to ~1.17.0 (#1824) (679c6b8)

4.0.5 (2023-09-07)

Bug Fixes

  • Always fill the topic and sub names when creating from a PubSub object (#1816) (be8ed53)

4.0.4 (2023-09-05)

Bug Fixes

4.0.3 (2023-08-31)

Bug Fixes

  • Simplify logic for HTTP/1.1 REST fallback option (#1809) (f26008d)

4.0.2 (2023-08-24)

Bug Fixes

  • Make retry policy back off more aggressively for RPCs that retry RESOURCE_EXHAUSTD (#1806) (e9969ba)

4.0.1 (2023-08-11)

Bug Fixes

  • deps: Update dependency @google-cloud/paginator to v5 (#1799) (3195d21)
  • deps: Update dependency @google-cloud/precise-date to v4 (#1803) (2c22d67)
  • deps: Update dependency @google-cloud/projectify to v4 (#1800) (5787d56)
  • deps: Update dependency @google-cloud/promisify to v4 (#1798) (093c46b)

4.0.0 (2023-08-03)

⚠ BREAKING CHANGES

  • node 12 eos (#1774) (#1784)

Features

Bug Fixes

3.7.3 (2023-07-26)

Bug Fixes

  • Update masks for topic should be snake case (#1778) (ba72638)

3.7.2 (2023-07-24)

Bug Fixes

3.7.1 (2023-06-08)

Bug Fixes

  • Don't crash if an already-drained/removed queue gets flushed again (#1747) (52ea441)

3.7.0 (2023-05-26)

Features

3.6.0 (2023-05-12)

Features

3.5.2 (2023-04-26)

Bug Fixes

  • Avoid zalgo when calling down to publish messages (#1710) (dedae1e)

3.5.1 (2023-04-20)

Bug Fixes

  • Handle receipt modAck and lease extensions with exactly-once delivery correctly (#1709) (d786d22)

3.5.0 (2023-04-16)

Features

  • Rework low level message stream retries, add debugging (#1713) (c1cc6e0)

3.4.1 (2023-03-08)

Bug Fixes

  • Update minimum google-gax to avoid taffydb vulnerabilities (#1695) (11372e6)

3.4.0 (2023-03-06)

Features

  • Add google.api.method.signature to update methods (1e28405)
  • Add temporary_failed_ack_ids to ModifyAckDeadlineConfirmation (1e28405)
  • Make INTERNAL a retryable error for Pull (#1681) (1e28405)

Bug Fixes

  • Don't do multiple drains per publish() in message queues unless requested (#1691) (d9b3a63)

3.3.0 (2023-01-23)

Features

Bug Fixes

3.2.1 (2022-11-04)

Bug Fixes

3.2.0 (2022-09-22)

Features

  • Add support for exactly once subscriptions (#1572) (998de35)

Bug Fixes

3.1.1 (2022-09-01)

Bug Fixes

3.1.0 (2022-07-15)

Features

  • add minExtension setting and plug it into EOS and ackDeadline settings (#1582) (8709979)

3.0.3 (2022-07-08)

Bug Fixes

  • pin @opentelemetry/semantic-conventions for Node 12 support (#1596) (f594061)

3.0.2 (2022-06-30)

Bug Fixes

  • deps: update dependency @google-cloud/precise-date to v3 (#1576) (69a5461)
  • deps: update dependency @google-cloud/projectify to v3 (#1584) (af4b13e)
  • docs: describe fallback rest option (#1591) (7c08686)

3.0.1 (2022-05-30)

Bug Fixes

  • deps: update dependency @google-cloud/paginator to v4 (#1565) (461b58b)
  • detect subscription properties and warn for exactly-once (#1561) (98cf540)

3.0.0 (2022-05-26)

⚠ BREAKING CHANGES

  • update library to use Node 12 (#1564)

Features

  • add BigQuery configuration for subscriptions (#1563) (29d38a1)

Bug Fixes

  • deps: update dependency google-gax to v2.30.4 (#1555) (518fce1)
  • fixes for dynamic routing and streaming descriptors (#1566) (158c606)

Build System

2.19.4 (2022-05-05)

Bug Fixes

  • deps: update dependency google-gax to v2.30.3 (#1549) (5810331)

2.19.3 (2022-04-26)

Bug Fixes

  • deps: update dependency google-gax to v2.30.2 (#1502) (37d075e)

2.19.2 (2022-04-21)

Bug Fixes

2.19.1 (2022-04-06)

Bug Fixes

  • deps: update dependency google-gax to v2.29.7 (#1493) (c8921a7)
  • deps: update dependency google-gax to v2.30.0 (#1496) (073a1b8)
  • update grpc.max_metadata_size to 4MiB for exactly-once, and shift ack/modack errors to 'debug' stream channel (#1505) (abd10cc)

2.19.0 (2022-02-16)

Features

Bug Fixes

  • deps: update dependency google-gax to v2.29.5 (#1474) (f855db3)
  • deps: update dependency google-gax to v2.29.6 (#1489) (62aba28)
  • removing misspelled field, add correctly spelled field 🦉 Updates from OwlBot (#1490) (afb9cfe)

2.18.5 (2022-01-21)

Bug Fixes

  • deps: update dependency @opentelemetry/semantic-conventions to v1 (#1407) (740d78c)
  • deps: update dependency google-gax to v2.29.0 (#1452) (f419137)
  • deps: update dependency google-gax to v2.29.4 (#1469) (8abbfa7)
  • update to work with latest node types (changed the return type of Stream.destroy()) (#1464) (fddc2e7)

2.18.4 (2021-12-09)

Bug Fixes

  • deps: update dependency google-gax to v2.28.1 (#1432) (98840fc)

2.18.3 (2021-11-18)

Bug Fixes

2.18.2 (2021-11-08)

Bug Fixes

2.18.1 (2021-09-27)

Bug Fixes

  • deprecate maxExtension in favour of maxExtensionMinutes (#1402) (46b83ba)

2.18.0 (2021-09-23)

Features

Bug Fixes

  • update default RPC retry timeouts to match other languages (#1399) (8c1afee)

2.17.0 (2021-08-25)

Features

Bug Fixes

2.16.6 (2021-08-19)

Bug Fixes

  • don't require a data attribute to be passed when sending a message (#1370) (97fd4f0)

2.16.5 (2021-08-18)

Bug Fixes

2.16.4 (2021-08-17)

Bug Fixes

2.16.3 (2021-08-11)

Bug Fixes

2.16.2 (2021-08-11)

Bug Fixes

  • deps: update opentelemetry monorepo to ^0.24.0 (#1349) (cf0d24a)

2.16.1 (2021-07-21)

Bug Fixes

  • Updating WORKSPACE files to use the newest version of the Typescript generator. (#1354) (7288e2e)

2.16.0 (2021-07-12)

Features

  • Add method signature for Subscriber.Pull without the deprecated return_immediately field. (#1350) (a7922fb)

Bug Fixes

2.15.1 (2021-06-22)

Bug Fixes

2.15.0 (2021-06-22)

Features

Bug Fixes

  • deps: update opentelemetry monorepo to ^0.21.0 (#1324) (c6d1750)

2.14.0 (2021-06-11)

Features

  • upgrade @opentelemetry/api to version 0.20.0 (#1305) (ed32369)

2.13.0 (2021-06-10)

Features

Bug Fixes

  • GoogleAdsError missing using generator version after 1.3.0 (#1299) (43a8fdb)

2.12.0 (2021-05-11)

Features

  • update publisher options all the way through the topic object tree (#1279) (70402ac)

Bug Fixes

2.11.0 (2021-04-14)

⚠ BREAKING CHANGES

  • fix: added support for Opentelemetry 0.18 - makes significant changes to OpenTelemetry support in order to unblock its usage again; the main user-visible change is that you will need to use 0.18+ versions of OpenTelemetry, and different items are passed to the server in spans.

Bug Fixes

  • added support for Opentelemetry 0.18 (#1234) (aedc36c)
  • follow-on proto updates from the removal of the common protos (#1229) (cb627d5)
  • prevent attempt to publish 0 messages (#1218) (96e6535)
  • remove common protos (#1232) (8838288)
  • reverting the major from the OpenTelemetry change (it was already broken) (#1257) (09c428a)
  • temporarily pin sinon at 10.0.0 (#1252) (0922164)

2.10.0 (2021-02-22)

Features

2.9.0 (2021-02-10)

Features

Bug Fixes

  • bind promisify calls for flush() so they have a 'this' value (#1184) (e494fb7)
  • deps: update dependency google-auth-library to v7 (#1207) (fce2af1)
  • openTelemetry doc fails to generate for #1185 (#1200) (0600bde)
  • update synchronousPull example to avoid INVALID_ARGUMENT error (#1194) (1f85345)

2.8.0 (2021-01-08)

Features

Bug Fixes

  • deps: update opentelemetry monorepo to ^0.12.0 (#1162) (f459a91)

2.7.0 (2020-11-30)

Features

  • Enable server side flow control by default with the option to turn it off (#1147) (a9c7e0b)
  • update generator to a new version (#1157) (3b1e99e)

Bug Fixes

  • do not modify options object, use defaultScopes (#1148) (4745c10)
  • node 14+ changes how multiple destroy() calls work (#1153) (e421749)

2.6.0 (2020-10-20)

Features

  • update synthtool generation for latest changes (#1128) (bdbe80f)

Bug Fixes

  • deps: update google-auth-library for security fix (#1122) (1eaf850)
  • add CANCELLED back to the auto-retry codes for pull subscriptions, for now (#1132) (47cd89c)
  • deps: update opentelemetry monorepo to ^0.11.0 (#1102) (c9d5638)
  • deps: upgrade google-auth-library (#1122) (54310a7)
  • move system and samples test from Node 10 to Node 12 (#1094) (693116a)

2.5.0 (2020-08-17)

Features

Bug Fixes

  • make request batching work again (#1087) (80e0ee3)
  • properly handle non-emulator alternate endpoints for pub/sub (#1060) (195ebf6)
  • deps: update opentelemetry monorepo to ^0.10.0 (#1090) (78a45ff)
  • update minimum gax version to 2.7.0 to fix recent protobuf errors (#1085) (904348c)

2.4.0 (2020-08-08)

Features

  • update to TypeScript 3.8+ to match gax/protobufjs (to allow things to compile again) (#1079) (cd39d38)

2.3.0 (2020-07-20)

Features

Bug Fixes

2.2.0 (2020-07-09)

Features

  • add flow control settings for StreamingPullRequest to pubsub.proto (#1035) (a7dff65)
  • move ts target to es2018 from es2016 (#1022) (016568d)
  • Re-export ClientConfig from pubsub.ts in package index.ts (#1038) (c2ac083), closes #972

Bug Fixes

2.1.0 (2020-06-02)

Features

  • re-generated to pick up changes from googleapis (#1014) (1ad3552)

Bug Fixes

  • use any to unblock typescript compilation bug (#1012) (1e8ced3)

2.0.0 (2020-05-20)

Please note that Node 8 is no longer supported, and Node 10 is the new minimum version of the runtime.

⚠ BREAKING CHANGES

  • Please note that Node 8 is no longer supported, and Node 10 is the new minimum version of the runtime.
  • drop support for custom promises (#970)
  • convert to typescript (#923)
  • deps: update dependency @google-cloud/projectify to v2 (#929)

Bug Fixes

  • docs: link to correct gaxOptions docs (#999) (312e318)
  • regen protos and tests, formatting (#991) (e350b97)
  • remove eslint, update gax, fix generated protos, run the generator (#955) (544a061)
  • remove unused dependencies (#998) (7b242a3)
  • close: ensure in-flight messages are drained (#952) (93a2bd7)
  • deps: update dependency @google-cloud/paginator to v3 (#931) (b621854)
  • deps: update dependency @google-cloud/precise-date to v2 (#934) (72b8d78)
  • deps: update dependency @google-cloud/projectify to v2 (#929) (45d9880)
  • deps: update dependency @google-cloud/promisify to v2 (#928) (3819877)
  • deps: update dependency google-auth-library to v6 (#935) (73fc887)

Build System

Miscellaneous Chores

1.7.1 (2020-04-06)

Bug Fixes

  • provide missing close() method in the generated gapic client (#941) (6bf8f14)

1.7.0 (2020-03-29)

Features

  • add a close() method to PubSub, and a flush() method to Topic/Publisher (#916) (4097995)

1.6.0 (2020-03-04)

Features

  • subscription: support oidcToken (#865) (a786ca0)
  • export protos in src/index.ts (f32910c)

Bug Fixes

  • deps: update to the latest google-gax to pull in grpc-js 0.6.18 (#903) (78bd9e9)
  • send the ITimestamp protobuf to Pub/Sub for seeking, not JavaScript Date() (#908) (0c1d711)

1.5.0 (2020-02-03)

Features

  • added clientId to StreamingPullRequest (b566ab3)
  • update defaults for batch settings also, and update which result codes will cause a retry (#877) (32ae411)

1.4.1 (2020-01-28)

Bug Fixes

  • enum, bytes, and Long types now accept strings (186778f)

1.4.0 (2020-01-24)

Features

  • defaults: update defaults for the node client library to match other pub/sub libraries (#859) (8d6c3f7)

1.3.0 (2020-01-14)

Features

  • subscription: dead letter policy support (#799) (b5a4195)

1.2.0 (2019-12-13)

Features

1.1.6 (2019-11-25)

Bug Fixes

  • deps: update dependency yargs to v15 (#820) (3615211)
  • docs: snippets are now replaced in jsdoc comments (#815) (b0b26ad)
  • adds streaming pull retry, and increases request thresholds (a7d4d04)
  • include long import in proto typescript declaration file (#816) (4b3b813)

1.1.5 (2019-10-22)

Bug Fixes

  • pull emulator creds from local grpc instance (#795) (1749b62)

1.1.4 (2019-10-22)

Bug Fixes

1.1.3 (2019-10-18)

Bug Fixes

  • deps: explicit update to google-auth-library with various fixes (#785) (c7b0069)
  • docs: add documentation about running C++ gRPC bindings (#782) (bdc690e)

1.1.2 (2019-10-09)

Bug Fixes

  • deps: remove direct dependency on @grpc/grpc-js (#773) (0bebf9b)

1.1.1 (2019-10-08)

Bug Fixes

  • update messaging retry timeout durations (#761) (922fe92)
  • use compatible version of google-gax (060207a)
  • deps: pin @grpc/grpc-js to ^0.6.6 (#772) (3c5199d)
  • docs: explain PubSub.v1 property (#766) (157a86d)

1.1.0 (2019-09-25)

Bug Fixes

  • deps: update dependency @google-cloud/pubsub to v1 (#750) (82305de)
  • deps: update dependency @grpc/grpc-js to ^0.6.0 (#759) (fda95c7)

Features

1.0.0 (2019-09-18)

⚠ BREAKING CHANGES

  • set release level to GA (#745)

Miscellaneous Chores

0.32.1 (2019-09-13)

Updates

  • dependency google-gax updated to ^1.5.2 to make sure the new version is pulled.

0.32.0 (2019-09-11)

Bug Fixes

Features

0.31.1 (2019-08-27)

Bug Fixes

  • deps: update dependency yargs to v14 (b0ceb5e)
  • use process versions object for client header (#722) (e65185b)

0.31.0 (2019-08-15)

Features

  • debug: capture stack trace in errors rather than message (#718) (bfed3f1)

0.30.3 (2019-08-03)

Bug Fixes

  • allow calls with no request, add JSON proto (1e73a69)

0.30.2 (2019-07-30)

⚠ BREAKING CHANGES

  • message: remove nack delay parameter (#668)

Bug Fixes

  • deps: update dependency @google-cloud/paginator to v2 (#700) (a5c0160)
  • deps: update dependency @grpc/grpc-js to ^0.5.0 (#698) (d48e578)
  • deps: update dependency @sindresorhus/is to v1 (#701) (e715172)
  • deps: update dependency google-auth-library to v5 (#702) (3a15956)
  • docs: reference docs should link to section of googleapis.dev with API reference (#670) (c92a09a)

Reverts

  • message: remove nack delay parameter (#668) (ca8fe65)

0.30.1 (2019-06-21)

Bug Fixes

  • deps: include missing @grpc/grpc-js dependency (#665) (5f42f60)

0.30.0 (2019-06-17)

⚠ BREAKING CHANGES

  • deps: use grpc-js instead of grpc extension (#658)
  • subscription: decouple retainAckedMessages from messageRetentionDuration (#625)
  • remove pullTimeout subscriber option (#618)

Bug Fixes

  • deps: update dependency @sindresorhus/is to ^0.17.0 (#591) (06fae6e)
  • deps: update dependency grpc to v1.21.1 (#629) (fcf75a2)
  • deps: update dependency p-defer to v3 (#650) (50f9d4e)
  • deps: upgrade module extend to fix CVE-2018-16492 (#644) (cd54630)
  • deps: use grpc-js instead of grpc extension (#658) (535a917)
  • docs: move to new client docs URL (#657) (a9972ea)
  • update regex to target correct comment (#646) (9e8f245)
  • update rpc timeout settings (#628) (2a1a430)
  • subscription: decouple retainAckedMessages from messageRetentionDuration (#625) (3431e7c)
  • typescript: pin grpc to previous working version (#624) (2167536)

Features

  • add .repo-metadata.json, start generating README.md (#636) (142f56c)
  • support apiEndpoint override (#647) (b44f566)

Reverts

  • remove pullTimeout subscriber option (#618) (4fc9724)

0.29.1 (2019-05-18)

Bug Fixes

  • use typescript import/export for gapics (#611) (e882e1a)

0.29.0 (2019-05-15)

Bug Fixes

  • deps: update dependency @google-cloud/paginator to v1 (#592) (181553a)
  • deps: update dependency @google-cloud/precise-date to v1 (#603) (2e669a1)
  • deps: update dependency @google-cloud/projectify to v1 (#588) (d01d010)
  • deps: update dependency @google-cloud/promisify to v1 (#589) (dad7530)
  • deps: update dependency arrify to v2 (#565) (8e3b7b8)
  • deps: update dependency google-auth-library to v4 (#601) (baf9d39)
  • deps: update dependency google-gax to v1 (#604) (6415e7c)
  • DEADLINE_EXCEEDED no longer treated as idempotent and retried (39b1dac)
  • DEADLINE_EXCEEDED retry code is idempotent (#605) (1ae8db9)
  • deps: update dependency google-gax to ^0.26.0 (#583) (4214a4f)
  • include 'x-goog-request-params' header in requests (#562) (482e745)
  • relax strictEqual to match RegExp (#566) (3388fb7)
  • deps: update dependency p-defer to v2 (#553) (fe33e40)

Build System

Features

  • subscriber: ordered messages (1ae4719)
  • subscription: accept pull timeout option (#556) (468e1bf)
  • subscription: ordered messages (#560) (38502ad)

BREAKING CHANGES

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

v0.28.1

03-11-2019 15:36 PDT

Bug Fixes

  • fix(typescript): correctly import long (#541)

Internal / Testing Changes

  • testing: set skipLibCheck to false for ts install test (#543)
  • refactor: fix/simplify proto gen scripts (#542)

v0.28.0

03-11-2019 09:11 PDT

New Features

  • feat(topic): create setMetadata method (#537)

Dependencies

  • fix(deps): update dependency @google-cloud/paginator to ^0.2.0

Internal / Testing Changes

  • build: Add docuploader credentials to node publish jobs (#533)
  • test: add missing packages and install test (#536)
  • refactor(typescript): noImplicitAny for Subscription test file (#534)

v0.27.1

03-06-2019 20:11 PST

Bug Fixes

  • fix(typescript): correct response type of Subscription.get (#525)

Documentation

  • fix(typo): correct typo: recieved => received (#527)

Internal / Testing Changes

  • build: update release configuration
  • refactor(typescript): noImplicitAny for message-stream test file (#522)
  • build: use node10 to run samples-test, system-test etc (#529)
  • refactor: type fixes and some light housekeeping (#528)

v0.27.0

03-04-2019 08:42 PST

Bug Fixes

  • refactor(typescript): various fixes/refactors to types (#515)
  • fix(ts): fix getPolicy promise return signature (#511)
  • fix(typescript): export all the types (#516)

Dependencies

  • refactor: clean up unused packages (#517)

Documentation

  • fix(docs): ensure docs are not removed by typescript (#512)
  • docs: update comments on protos (#509)

Internal / Testing Changes

  • refactor(typescript):noImplicitAny for index test file (#502)
  • refactor(ts): enable noImplicitAny for IAM test file (#501)
  • refactor(ts): enable noImplicitAny for lease-manager test file (#508)
  • refactor(ts): enable noImplicitAny for Histogram and Message_queues test file (#510)
  • refactor(ts): enable noImplicitAny for pubsub system test file (#519)
  • refactor(ts): noImplicitAny for publisher test file (#520)

v0.26.0

02-28-2019 05:42 PST

BREAKING: message.publishTime is now represented by a PreciseDate object. (#503)

The PreciseDate class extends the native Date object, so most users should be unaffected by this change. The notable differences between PreciseDate and Date objects are:

  • toISOString() now returns as a RFC 3339 formatted string.
  • Nano and microsecond data is available via date.getNanoseconds() and date.getMicroseconds() respectively.

New Features

  • feat(typescript): ship typescript declaration files (#498)
  • feat(subscription): support push config auth methods (#504)

Internal / Testing Changes

  • refactor(typescript): noImplicitAny for snapshot and subscriber test file (#490)
  • fix(messageStream): remove call to destroy grpc stream (#499)

v0.25.0

02-20-2019 10:35 PST

Implementation Changes

  • fix: throw on invalid credentials and update retry config (#476)

The retry logic for all methods has changed. It is possible that this could go unnoticed, however if you suddenly start seeing errors in places that were previously quiet, this might account for said errors.

New Features

  • refactor(ts): improve TypeScript types (#482)
  • refactor(typescript): noImplicityAny for snapshot.ts and publisher.ts (#457)

Bug Fixes

  • fix: ignore messages that come in after close (#485)

Dependencies

  • chore(deps): update dependency mocha to v6 (#488)
  • fix(deps): update dependency @google-cloud/promisify to ^0.4.0 (#478)
  • fix(deps): update dependency yargs to v13 (#475)
  • fix(deps): update dependency duplexify to v4 (#462)
  • fix(deps): update dependency google-gax to ^0.25.0 (#456)

Documentation

  • docs: update links in contrib guide (#479)
  • docs: update contributing path in README (#471)
  • chore: move CONTRIBUTING.md to root (#470)
  • docs: make mention of message change in changelog (#469)
  • docs: add lint/fix example to contributing guide (#464)
  • fix(sample): fix retry codes in retry sample code (#458)

Internal / Testing Changes

  • test(samples): correctly handle publishTime value (#495)
  • test: fix publishTime issues (#494)
  • refactor(typescript): noImplicityAny for Topic test file (#487)
  • refactor(ts): noImplicitAny for subscription test file (#489)
  • build: use linkinator for docs test (#477)
  • build: create docs test npm scripts (#474)
  • build: test using @grpc/grpc-js in CI (#472)
  • test: update code style of smoke test (#463)
  • test: make smoke test spam less (#459)

v0.24.1

01-29-2019 13:17 PST

Bug Fixes

  • fix(publisher): unbound max send message size (#454)

v0.24.0

01-28-2019 09:54 PST

New Features

  • fix(auth): pass project id to gax clients (#447)
  • refactor(typescript): noImplicityAny for topic.ts and subscription.ts (#420)
  • refactor: improve subscriber error handling (#440)
  • feat(subscription): auto close sub on non-recoverable errors (#441)

Dependencies

  • chore(deps): update dependency eslint-config-prettier to v4 (#450)
  • fix(deps): update dependency google-gax to ^0.24.0 (#444)
  • fix(deps): update dependency google-auth-library to v3 (#433)

Documentation

  • build: ignore googleapis.com in doc link check (#439)
  • chore: update year in the license headers. (#434)

Internal / Testing Changes

  • chore: remove trailing whitespace in package.json
  • fix(sample): factor setTimeout jitter into assertion (#449)
  • fix(test): broken snapshot test hook (#448)

v0.23.0

01-16-2019 13:09 PST

This release has breaking changes.

BREAKING: Topic#publisher() has been removed in favor of Topic#publish() (#426)

Before

const publisher = topic.publisher(publishOptions);
await publisher.publish(Buffer.from('Hello, world!'));

After

topic.setPublishOptions(publishOptions);
await topic.publish(Buffer.from('Hello, world!'));

BREAKING: Subscription options have changed. (#388)

Before

const subscription = topic.subscription('my-sub', {
  batching: {
    maxMilliseconds: 100,
  },
  flowControl: {
    maxBytes: os.freem() * 0.2,
    maxMessages: 100,
  },
  maxConnections: 5,
});

After

const subscription = topic.subscription('my-sub', {
  ackDeadline: 10,
  batching: {
    callOptions: {}, // gax call options
    maxMessages: 3000,
    maxMilliseconds: 100,
  },
  flowControl: {
    allowExcessMessages: true,
    maxBytes: os.freem() * 0.2,
    maxExtension: Infinity,
    maxMessages: 100
  },
  streamingOptions: {
    highWaterMark: 0,
    maxStreams: 5, // formerly known as maxConnections
    timeout: 60000 * 5, // 5 minutes
  }
});

BREAKING: messages are no longer plain objects. (#388)

Messages were refactored into a class, this will only affect (some) users who treat messages like plain old objects.

The following example is something that would have worked previously, but will now throw a TypeError since ack lives on the prototype chain.

const m = Object.assign({}, message, customData);
m.ack(); // TypeError: m.ack is not a function

New Features

  • feat(topic): create method for publishing json (#430)

Dependencies

  • fix(deps): update dependency google-gax to ^0.23.0 (#423)
  • chore(deps): update dependency @types/sinon to v7 (#411)
  • chore: update nyc and eslint configs (#409)

Documentation

  • docs(samples): correct publish retry settings (#419)
  • docs: sync generated grpc message type docs
  • fix(docs): remove unused long running operations and IAM types
  • fix: modernize the sample tests (#414)

Internal / Testing Changes

  • chore: update subscriber gapic
  • fix: add getSubscriberStub to synth file (#425)
  • build: check broken links in generated docs (#416)
  • chore(build): inject yoshi automation key (#410)
  • chore: fix publish.sh permission +x (#406)
  • fix(build): fix Kokoro release script (#404)

v0.22.2

12-10-2018 09:37 PST

Implementation Changes

TypeScript related changes:

  • fix(ts): copy gapic code properly (#399)

Documentation

  • fix(docs): add subscription expiration policy docs (#400)
  • Add migration for v0.20.0 from v0.19.0 (#398)

v0.22.1

12-06-2018 17:11 PST

Dependencies

  • chore(deps): update dependency typescript to ~3.2.0 (#380)

Documentation

  • fix(docs): place doc comment above the last overload (#393)
  • docs: Update documentation for Subscription (#387)
  • docs: Add documentation about defaults for publisher (#384)
  • docs: update readme badges (#383)

Internal / Testing Changes

  • chore: always nyc report before calling codecov (#392)
  • chore: nyc ignore build/test by default (#391)
  • chore: update license file (#386)

v0.22.0

Implementation Changes

  • fix(ts): do not ship types (#377)

Road to TypeScript

  • refactor(ts): improve types (2) (#356)
  • refactor(ts): updated lint and fix command to cover gts (#375)
  • refactor(ts): added ts style fix for src/iam.ts (#352)
  • refactor(ts): Added ts style fix for test/topic.ts (#373)
  • refactor(ts): Added ts style fix for test/subscription.ts (#372)
  • refactor(ts): Added ts style fix for test/subscriber.ts (#371)
  • refactor(ts): Added ts style fix for test/snapshot.ts (#370)
  • refactor(ts): Added ts style fix for test/publisher.ts (#369)
  • refactor(ts): added ts style fix for src/index.ts (#351)
  • refactor(ts): added ts style fix for src/publisher.ts (#357)
  • refactor(ts): added ts style fix for src/snapshot.ts (#358)
  • refactor(ts): added ts style fix for src/subscriber.ts (#359)
  • refactor(ts): added ts style fix for src/subscription.ts (#360)
  • refactor(ts): added ts style fix for src/topic.ts (#361)
  • refactor(ts): added ts style fix for src/util.ts (#362)
  • refactor(ts): added ts style fix for test/connection-pool.ts (#364)
  • refactor(ts): added ts style fix for test/histogram.ts (#365)
  • refactor(ts): added ts style fix for test/iam.ts (#366)
  • refactor(ts): added ts style fix for test/index.ts (#368)
  • refactor(ts): added ts style fix for src/connection-pool.ts (#353)
  • refactor(ts): added ts style fix for src/histogram.ts (#354)
  • refactor(ts): enable noImplicitAny on src/iam.ts (#348)
  • added ts style fix for system-test/pubsub.ts (#374)
  • chore: ts-ignoring some stuff in tests (#343)

Dependencies

  • fix: Pin @types/sinon to last compatible version (#345)
  • chore(deps): update dependency @types/sinon to v5.0.7 (#349)

Documentation

  • docs(samples): Publish with Retry Setting Example (#355)
  • docs: remove outdated comments (#342)

Internal / Testing Changes

  • chore: add a synth.metadata
  • feat: Add optional delay when calling nack() (#255) (#256)

v0.21.1

Bug fixes

  • fix: include protos in the package (#336)

v0.21.0

11-12-2018 17:25 PST

Implementation Changes

BREAKING CHANGE @google-cloud/pubsub now uses ES6 import/export syntax since v0.21.0.

Before:

const pubsub = require('@google-cloud/pubsub')();
// OR
const PubSub = require('@google-cloud/pubsub');
const pubsub = new PubSub();

Now:

const {PubSub} = require('@google-cloud/pubsub');
const pubsub = new PubSub();
  • refactor: use Object.assign where possible (#324)
  • fix(subscription): promisify Subscription#close (#282)
  • fix: maxBytes batching sending empty messages (#281)
  • (New) Synchronous Pull with Lease Management (#272)
  • Switch to let/const (#254)

Road to TypeScript

  • refactor(ts): introduce a round of types (#319)
  • refactor(ts): enable noImplicitThis (#316)
  • refactor(ts): convert to typescript (#310)

New Features

  • feat: add expiration policy (#287)

Dependencies

  • chore(deps): update dependency eslint-plugin-prettier to v3 (#274)
  • fix(deps): update dependency google-proto-files to ^0.17.0 (#284)
  • chore(deps): update dependency sinon to v7 (#285)
  • chore(deps): update dependency eslint-plugin-node to v8 (#300)
  • fix(deps): update dependency through2 to v3 (#320)
  • refactor: drop dependencies on google-proto-files and async (#329)
  • chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 (#328)
  • chore(deps): update dependency @types/is to v0.0.21 (#323)
  • fix(deps): update dependency google-gax to ^0.20.0 (#252)

Documentation

  • fix quickstart tag in v0.20 docs (#271)

Samples

  • Pub/Sub Synchronous Pull Example (#259)
  • Update sample topic and subscription names
  • Add Pub/Sub ack deadline example (#315)
  • docs(samples): update samples to use async/await (#305)
  • chore: adjust samples timeout (#283)
  • Fix the topic name in the samples (#262)

Internal / Testing Changes

  • chore: update eslintignore config (#332)
  • chore(build): eslint all js files, and use js for all generated files (#331)
  • chore: drop contributors from multiple places (#325)
  • chore: use latest npm on Windows (#322)
  • chore: update CircleCI config (#309)
  • chore: include build in eslintignore (#304)
  • chore: update issue templates (#299)
  • chore: remove old issue template (#297)
  • build: run tests on node11 (#296)
  • chores(build): do not collect sponge.xml from windows builds (#295)
  • chores(build): run codecov on continuous builds (#294)
  • chore: update new issue template (#293)
  • build: fix codecov uploading on Kokoro (#286)
  • Update kokoro config (#275)
  • Update Kokoro configs (#270)
  • Update kokoro config (#269)
  • test: remove appveyor config (#268)
  • Update CI config (#266)
  • Run prettier on smoke tests (#265)
  • Fix the linter (#261)
  • Enable prefer-const in the eslint config (#260)
  • Enable no-var in eslint (#257)

v0.20.1

Documentation

  • fix(docs): correct region tag for sample documentation (#272)

v0.20.0

Implementation Changes

BREAKING CHANGE: - fix: drop support for node.js 4.x and 9.x (#171)

BREAKING CHANGE @google-cloud/pubsub now requires new.

Before:

const PubSub = require('@google-cloud/pubsub');
const pubsub = PubSub();

Now:

const PubSub = require('@google-cloud/pubsub');
const pubsub = new PubSub();

New Features

  • Re-generate library using /synth.py (#227)
    • some minor proto documentation changes

Dependencies

  • fix(deps): update dependency google-auth-library to v2 (#228)
  • chore(deps): update dependency nyc to v13 (#225)
  • fix(deps): update dependency google-gax to ^0.19.0 (#216)
  • chore(deps): update dependency eslint-config-prettier to v3 (#213)
  • chore: drop dependency on @google-cloud/common (#210)
  • fix(deps): update dependency @google-cloud/common to ^0.21.0 (#206)
  • chore(deps): lock file maintenance (#203)
  • fix(deps): update dependency google-gax to ^0.18.0 (#197)
  • chore(deps): lock file maintenance (#196)
  • chore(deps): lock file maintenance (#188)
  • chore(deps): update dependency eslint-plugin-node to v7 (#185)
  • chore(deps): lock file maintenance (#182)
  • chore(deps): lock file maintenance (#174)
  • chore(deps): lock file maintenance (#173)
  • chore(deps): lock file maintenance (#172)
  • chore(deps): lock file maintenance (#168)
  • chore(deps): lock file maintenance (#167)
  • chore(deps): lock file maintenance (#166)
  • fix(deps): update dependency delay to v3 (#165)
  • fix(deps): update dependency @google-cloud/common to ^0.20.0 (#155)
  • chore(deps): update dependency proxyquire to v2 (#160)
  • chore(deps): update dependency nyc to v12 (#159)
  • Update google-gax and add Synth.py (#158)
  • chore(deps): update dependency sinon to v6 (#161)
  • fix(deps): update dependency yargs to v12 (#164)
  • fix(deps): update dependency yargs to v11 (#163)
  • fix(deps): update dependency yargs to v10.1.2 (#157)
  • chore(deps): update dependency ava to ^0.25.0 (#153)
  • chore(deps): update dependency sinon to v4.5.0 (#154)

Documentation

  • fix docs (#229)
  • test: fix import sample failures (#218)
  • fix: correct the documentation (#117)
  • fix: Fix sample region tag in JSDoc (#184)
  • Fixes 179: Adds missing return statement in docs (#180)

Internal / Testing Changes

  • Update the CI config (#220)
  • chore: make the CircleCI config consistent
  • chore: use arrow functions (#215)
  • chore: convert to es classes (#211)
  • chore: do not use npm ci (#209)
  • chore: use let and const (#204)
  • chore: ignore package-lock.json (#207)
  • chore: use split common modules (#200)
  • chore: update renovate config (#199)
  • chore: move mocha options to mocha.opts (#194)
  • chore: require node 8 for samples (#195)
  • chore: add node templates to synth.py (#191)
  • chore: fix the eslint errors (#190)
  • refactor: use google-auth-library (#189)
  • Fixes 177: Prevents publishing attributes that have non-string values (#183)
  • chore(build): use npm ci instead of npm install (#175)
  • chore(package): update eslint to version 5.0.0 (#145)
  • chore: update sample lockfiles (#149)
  • test: use strictEqual in tests (#186)
  • Configure Renovate (#144)
  • refactor: drop repo-tool as an exec wrapper (#150)
  • fix: update linking for samples (#146)