Skip to content

PubSub.close throws error #937

@mad-it

Description

@mad-it

This bug report is related to #916.

Environment details

  • OS: Linux
  • Node.js version: v10.16.3
  • npm version: 6.9.0
  • @google-cloud/pubsub version: 1.7.0

Steps to reproduce

Here is a test written to test this newly introduced close method.

import { PubSub } from '@google-cloud/pubsub';

it('test pubsub close', async (): Promise<void> => {
  expect.assertions(1);
  const topicName = 'test-topic';

  const pubSub = new PubSub();

  const [topic] = await pubSub.topic(topicName).get({ autoCreate: true });

  await topic.publish(Buffer.from('test-message'));

  expect(await pubSub.topic(topicName).exists()).toStrictEqual([true]);

  await pubSub.close();
});

When running this simple test in Jest, I get the following error.

 FAIL  src/test.spec.ts (7.801s)
  ✕ test pubsub close (106ms)

  ● test pubsub close

    TypeError: gaxClient.close is not a function

      13 |   expect(await pubSub.topic(topicName).exists()).toStrictEqual([true]);
      14 | 
    > 15 |   await pubSub.close();
         |                ^
      16 | });
      17 | 

      at PubSub.closeAllClients_ (node_modules/@google-cloud/pubsub/src/pubsub.ts:983:31)
      at PubSub.close (node_modules/@google-cloud/pubsub/src/pubsub.ts:302:12)
      at PromiseCtor (node_modules/@google-cloud/promisify/build/src/index.js:69:28)
      at PubSub.wrapper (node_modules/@google-cloud/promisify/build/src/index.js:54:16)
      at Object.it (src/test.spec.ts:15:16)

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the googleapis/nodejs-pubsub API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions