Skip to content

pubsub: publisher().publish() returns an array when used with promises #2671

@kevynb

Description

@kevynb

Hello,

I use the lib with promises instead of callbacks and when I publish a message I expect to get the messageId as a string, however I get an array containing the string: ['some-id']. Since the documentation seems to say otherwise, I assume it's a bug

It works correctly when I use it with a callback.

Environment details

  • OS: MacOS
  • Node.js version: 8.5
  • google-cloud-node version: 0.14.5

Steps to reproduce

  1. require google-cloud
    const buffer = new Buffer(JSON.stringify(message));
    const r = await this.pubsub.topic(topicName).publisher().publish(buffer)[0];
    console.log('messageId', r);

Thanks!

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.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