Skip to content

PubSub's ConnectionPool doesn't replace the {{projectId}} placeholder #2576

@jviide

Description

@jviide

Environment details

  • OS: MacOS 10.12.6
  • Node.js version: 8.4.0
  • npm version: 5.3.0
  • google-cloud-node version: 0.14.0

Steps to reproduce

Running the following example code:

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

pubsub
  .createTopic("test-topic")
  .then(
    ([topic]) => topic,
    err => {
      if (err.code === 6) {
        return pubsub.topic("test-topic");
      }
      throw err;
    }
  )
  .then(topic => {
    return topic.createSubscription("test-subscription");
  })
  .then(([sub]) => {
    sub.on("message", () => {});
    sub.on("error", err => {
      throw err;
    });
  });

crashes with the error message:

Error: Requested project not found or user does not have access to it (project={{projectId}}). Make sure to specify the unique project identifier and not the Google Cloud Console display name.
    at ClientDuplexStream.<anonymous> (./node_modules/@google-cloud/pubsub/src/connection-pool.js:223:21)
    at emitOne (events.js:115:13)
    at ClientDuplexStream.emit (events.js:210:7)
    at ClientDuplexStream._emitStatusIfDone (./node_modules/grpc/src/node/src/client.js:260:10)
    at ClientDuplexStream._receiveStatus (./node_modules/grpc/src/node/src/client.js:233:8)
    at ./node_modules/grpc/src/node/src/client.js:757:12

The ConnectionPool#createConnection implementation might play a part in this. The connection.write call on lines 232-235 uses a subscription name where the {{projectId}} placeholder has not been replaced with the actual project id.

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