question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: channelCredentials._equals is not a function

See original GitHub issue

This issue occurs on versions 1.1.2 and later.

When attempting to publish a message to the emulator, I’m getting the following error:

TypeError: channelCredentials._equals is not a function

Function to re-create error:

const pub = async (topicName, data) => {
  const options = {
    keyFilename,
    projectId
  };
  if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {
    options.apiEndpoint = 'emulator:8085';
  }
  const pubsub = new PubSub(options);
  const stringifiedData = JSON.stringify(data);
  const dataBuffer = await Buffer.from(stringifiedData);

  const topic = `projects/${projectId}/topics/${topicName}`;

  return pubsub
    .topic(topic)
    .publish(dataBuffer)
    .then((response) => {
      logger.info('Message published.', response);
      return {
        success: true
      };
    })
    .catch((error) => {
      logger.error('Failed to publish topic', error);
      return {
        success: false
      };
    });
};

Dockerfile of emulator:

FROM google/cloud-sdk:alpine

LABEL maintainer="LADbible Group"

RUN apk --update add openjdk7-jre
RUN gcloud components install --quiet beta pubsub-emulator
RUN gcloud components update
RUN mkdir -p /var/pubsub

VOLUME /var/pubsub

EXPOSE 8085

CMD [ "gcloud", "beta", "emulators", "pubsub", "start", "--data-dir=/var/pubsub", "--host-port=0.0.0.0:8085", "--log-http", "--verbosity=debug", "--user-output-enabled" ]

Environment details

  • OS: alpine
  • Node.js version: 10.15.0
  • npm version: 6.5.0
  • @google-cloud/pubsub version: 1.1.2+

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kbariotiscommented, Jan 13, 2020

Found the same when attempting to connect to the emulator. Latest version of both the emulator and this library.

1reaction
meredithslotacommented, Jun 23, 2020

@feywind If the issue isn’t resolved with the new version of grpc-js (and it’s still an issue with the emulator) let’s kick it to @kamalaboulhosn for guidance on ownership.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: $.equals is not a function - Stack Overflow
Ok, first things first. When something goes wrong, and you decide to debug it with console.log, NEVER use + . Yes, I know...
Read more >
node_modules/@grpc/grpc-js/src/channel-credentials.ts
Check whether two channel credentials objects are equal. Two secure. 112. * credentials are equal if they were constructed with the same ...
Read more >
How to Uncaught TypeError: x is not a function - YouTube
TypeError : "x" is not a functionThe JavaScript exception "is not a function " occurs when there was an attempt to call a...
Read more >
2 Server Error Message Reference - MySQL :: Developer Zone
Message: %s is not allowed in stored function or trigger ... Message: Binary operands of bitwise operators must be of equal length.
Read more >
How to use ChannelCredentials in grpc - Javascript - Tabnine
ChannelCredentials (Showing top 4 results out of 315). Tabnine vs. GitHub Copilot ... function getGrpcClientStream () { const client = new helloPkg.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found