Skip to content

Library fails with "this.auth.getUniverseDomain is not a function" when using pubsub #215

@lucasvickers

Description

@lucasvickers
  1. Is this a client library issue or a product issue?
    Appears to be a library issue

  2. Did someone already solve this?
    Related to the following posts, but I'm unable to resolve:

  1. Do you have a support contract?
    No

Environment details

  • OS: OS X 14.4.1
  • Node.js version: v21.7.2
  • npm version: 10.5.0
  • gax-nodejs version: 4.3.2

Steps to reproduce

I'm attempting to run the following code:

  const {PubSub} = require('@google-cloud/pubsub');
  const {OAuth2Client} = require('google-auth-library');

  token = "...";  // access_token generated externally

  const gax = new OAuth2Client();
  gax.setCredentials({access_token: token});

  const pubsub = new PubSub({
    projectId: projectId,
    auth: gax
  });

  const [topics] = await pubsub.getTopics();

With the newest versions of each library, I get the following error:

TypeError: this.auth.getUniverseDomain is not a function
    at GrpcClient.createStub (.../node_modules/google-gax/build/src/grpc.js:312:54)

Libraries:

I confirmed in my package-lock.json there are no old versions present in the dependencies. Attached for reference: package-lock.json

Following instructions on related links, I tried downgrading to various different versions, but similar errors continue. Random example:

TypeError: this.auth.getClient is not a function
    at GrpcClient._getCredentials (.../node_modules/@google-cloud/pubsub/node_modules/google-gax/build/src/grpc.js:145:40)

Libraries:

Metadata

Metadata

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions