Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using "topic.exists()" raises "TypeError: Channel's second argument must be a ChannelCredentials" #31

Closed
MohsenElgendy opened this issue Jan 5, 2018 · 12 comments
Assignees
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: question Request for information or clarification. Not an issue.

Comments

@MohsenElgendy
Copy link

Environment details

  • OS: Ubuntu 16.04
  • Node.js version: 9.3.0
  • npm version: 5.5.1
  • @google-cloud/pubsub version: 0.16.1

Steps to reproduce

  1. Setup PubSub emulator and set PUBSUB_EMULATOR_HOST
  2. run topic.exists()

This issue does not happen with PubSub version 0.15.0, when upgrading to 0.16.* and calling topic.exists() the following error occur:

[0] (node:48) UnhandledPromiseRejectionWarning: TypeError: Channel's second argument must be a ChannelCredentials
[0]     at ServiceClient.Client (/usr/src/app/node_modules/google-gax/node_modules/grpc/src/client.js:472:19)
[0]     at new ServiceClient (/usr/src/app/node_modules/google-gax/node_modules/grpc/src/client.js:884:12)
[0]     at /usr/src/app/node_modules/google-gax/lib/grpc.js:245:12
[0]     at <anonymous>
[0]     at process._tickCallback (internal/process/next_tick.js:160:7)
[0]     at Function.Module.runMain (module.js:703:11)
[0]     at startup (bootstrap_node.js:194:16)
[0]     at bootstrap_node.js:618:3
[0] (node:48) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
[0] (node:48) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Thanks!

@stephenplusplus
Copy link
Contributor

Would you mind doing a full un- and re-installation of your project's node_modules (rm -rf node_modules && npm install). If that still doesn't work, try npm cache clean --force before the command.

@stephenplusplus stephenplusplus added priority: p2 Moderately-important priority. Fix may not be included in next release. type: question Request for information or clarification. Not an issue. labels Jan 5, 2018
@MohsenElgendy
Copy link
Author

Every time I try, I build a new Docker image, that means it is a clean install and I also tried the cache clean and it did not work. Could it be a problem with the Emulator version it self ?

@fardog
Copy link

fardog commented Jan 5, 2018

I'm seeing this issue as well; an npm cache clean --force did not change the behavior, nor did whacking the package-lock.json and regenerating it from an npm install unfortunately.

{ '<redacted>': '1.2.0',
  npm: '5.5.1',
  ares: '1.10.1-DEV',
  cldr: '31.0.1',
  http_parser: '2.7.0',
  icu: '59.1',
  modules: '57',
  nghttp2: '1.25.0',
  node: '8.9.1',
  openssl: '1.0.2m',
  tz: '2017b',
  unicode: '9.0',
  uv: '1.15.0',
  v8: '6.1.534.47',
  zlib: '1.2.11' }

Let me know if i can provide any additional information.

Edit: the installation of pubsub was into a project that hasn't previously had any google cloud libraries intalled in it; it was installed with an npm install @google-cloud/pubsub which got me version 0.16.1; for the sake of getting things rolling, I tried an older version by specifying 0.15.0 and that version is working fine against the emulator.

@stephenplusplus
Copy link
Contributor

This sounds like a problem with multiple versions of gRPC loading. I believe I've found the issue, and will be sending a PR soon.

@stephenplusplus
Copy link
Contributor

0.16.2 is out! Please let me know if there are still any issues.

@MohsenElgendy
Copy link
Author

Seamless, Great work!

@giltayar
Copy link

Thanks. This solved my problem. Just wanted to let you know that there are no prebuilt binaries for node 8 (at least for the version I'm using) and grpc-1.7.3. This makes my docker build times really long...

Is there any way I can know what prebuilt binaries there are for this version of grpc and node, so I can fine tune the node version?

@ncjones
Copy link

ncjones commented Jan 30, 2018

@giltayar Are you using Alpine? I think this is related to glibc vs musl (grpc/grpc#6850). For this and other reasons we switched from Alpine back to Debian and we are able to use prebuilt grpc binaries (using pubsub 0.16.2).

@giltayar
Copy link

Yes, I am. Ahhh.... thank you. I'll switch back to the regular debian. Thanks!

Although, given the love a lot of people have for Alpine, it would be nice to have prebuilt binaries for them too... 😉

@cmdshepard
Copy link

cmdshepard commented Feb 15, 2018

@stephenplusplus I'm experiencing the same issue with 0.16.3 when I downgrade to 0.16.2, I no longer get the error.

I'm trying to connect to the pubsub emulator.

OS: macOS 10.13.3
Node.js version: 8.7.0
npm version: 5.4.2
Yarn version: 1.3.2
version: 0.16.3

This is the error that I get on 0.16.3

TypeError: Channel's second argument must be a ChannelCredentials
    at ServiceClient.Client (/Users/mazahmadi/microservices/financial-processing-service/node_modules/google-gax/node_modules/grpc/src/client.js:472:19)
    at new ServiceClient (/Users/mazahmadi/microservices/financial-processing-service/node_modules/google-gax/node_modules/grpc/src/client.js:884:12)
    at /Users/mazahmadi/microservices/financial-processing-service/node_modules/google-gax/lib/grpc.js:251:12
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
    at Function.Module.runMain (module.js:667:11)
    at Object.<anonymous> (/Users/mazahmadi/microservices/financial-processing-service/node_modules/babel-cli/lib/_babel-node.js:154:22)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Function.Module.runMain (module.js:665:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

stephenplusplus pushed a commit that referenced this issue Jun 11, 2018
## Version **0.16.0** of [google-proto-files](https://github.com/googleapis/nodejs-proto-files) was just published.

<table>
  <tr>
    <th align=left>
      Dependency
    </th>
    <td>
      <code>google-proto-files</code>
    </td>
  </tr>
  <tr>
      <th align=left>
       Current Version
      </th>
      <td>
        0.15.1
      </td>
    </tr>
  <tr>
    <th align=left>
      Type
    </th>
    <td>
      dependency
    </td>
  </tr>
</table>

The version **0.16.0** is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

It might be worth looking into these changes and trying to get this project onto the latest version of google-proto-files.

If you have a solid test suite and good coverage, a passing build is a strong indicator that you can take advantage of these changes directly by merging the proposed change into your project. If the build fails or you don’t have such unconditional trust in your tests, this branch is a great starting point for you to work on the update.


---


<details>
<summary>Release Notes</summary>
<strong>v0.16.0</strong>

<h2>Features</h2>
<ul>
<li>(<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="316092585" data-permission-text="Issue title is private" data-url="googleapis/nodejs-proto-files#35" href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/pull/35">#35</a>): Allow passing <code>load()</code> options to protobuf.js. (Thanks, <a class="user-mention" data-hovercard-user-id="583593" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/nmccready">@nmccready</a>!)</li>
</ul>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 19 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/b4d00bd0b7e6c2d4e0be1395739ded62bd9083e3"><code>b4d00bd</code></a> <code>0.16.0 (#44)</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/47488981af49c1102737e60cad560f9609ac29d2"><code>4748898</code></a> <code>feat: allow load options (#35)</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/91a34aa6ec2fb31932a03f4ed7756210146ea163"><code>91a34aa</code></a> <code>Merge pull request #42 from googleapis/greenkeeper/nyc-12.0.1</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/fca6f7540c45b1ec3916602e1189cef289429908"><code>fca6f75</code></a> <code>Update package.json</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/f0473ada67034a0a294d3f15dd1aa968acb5750a"><code>f0473ad</code></a> <code>chore(package): update nyc to version 12.0.1</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/057563111be9bf9e97e02f893fbed08a9b465db2"><code>0575631</code></a> <code>chore: lock files maintenance (#41)</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/5f38e7f77b6c14a5bbc256acb598fe10f4dbb693"><code>5f38e7f</code></a> <code>chore: lock files maintenance (#38)</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/d077e0b86bf56135301a5240a15c4cbbabf2eb47"><code>d077e0b</code></a> <code>chore: test on node10 (#37)</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/7855ccaca6a1f323719ef2c5a6c77ddd06953cb6"><code>7855cca</code></a> <code>chore: lock files maintenance (#36)</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/e5548189863303d1973d54c5dc23d5eb599fbdaa"><code>e554818</code></a> <code>Merge pull request #32 from googleapis/greenkeeper/sinon-5.0.0</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/0ecbb5e631d5918b8e1cf09e6ab1b6ed6d3baa64"><code>0ecbb5e</code></a> <code>Update package locks</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/838e2d1d84db3e15a0a5a73242ac7399709d6a44"><code>838e2d1</code></a> <code>chore(package): update sinon to version 5.0.0</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/fb18058f58c906ff9e90be80d4f312dbfb9ff68f"><code>fb18058</code></a> <code>chore: workaround for repo-tools EPERM (#33)</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/cf5968e2974b0cecbb6a807ffde696ec37dd6fe6"><code>cf5968e</code></a> <code>chore: setup nighty build in CircleCI (#31)</code></li>
<li><a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/commit/c4c973a41ee5810052fb0159ae2f83c18e6f866f"><code>c4c973a</code></a> <code>chore(package): update proxyquire to version 2.0.0 (#30)</code></li>
</ul>
<p>There are 19 commits in total.</p>
<p>See the <a href="https://urls.greenkeeper.io/googleapis/nodejs-proto-files/compare/89183d7d25f9c7e3b9097da820d9d84bd803a92f...b4d00bd0b7e6c2d4e0be1395739ded62bd9083e3">full diff</a></p>
</details>

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
@crivera
Copy link

crivera commented Mar 18, 2019

I have the same issue in version 0.28.0

const pubsub = require('@google-cloud/pubsub')
const grpc = require('grpc')

const client = new pubsub.v1.SubscriberClient({
  servicePath: 'localhost',
  port: 8085,
  sslCreds: grpc.credentials.createInsecure()
})

Any help would be appreciated. Node 8.11.3

(node:39711) UnhandledPromiseRejectionWarning: TypeError: Channel's second argument must be a ChannelCredentials

@google-cloud-label-sync google-cloud-label-sync bot added the api: pubsub Issues related to the googleapis/nodejs-pubsub API. label Jan 31, 2020
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Apr 6, 2020
@zombieleet
Copy link

@crivera Were you still able to fix this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

9 participants