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.

Google PubSub Import Error

See original GitHub issue

Environment details OS: Windows Node.js version: v13.10.1 npm version: 6.13.7 Google Cloud SDK 293.0.0 bq 2.0.57 core 2020.05.15 gsutil 4.50

Steps to reproduce Importing @google-cloud/pubsub results in what looks like a combination of bootstrap and GRPC errors. I have included the stack trace and package.json for reference. The error appears to be an issue from google gax and grpc status codes (undefined).

stack trace: errorStackTrace.txt

package.json : package.txt

Steps I Have Taken That Did Not Fix -reinstalled Google Pub Sub through npm -removed all node-modules, cleared npm cache, and ran npm install -installed GRPC, attempted to import GRPC and use it to initialize PubSub -reinstalled Firebase through npm *deleted package-lock before reinstalling through npm

Reference This issue occurs just by importing PubSub, no initialization of PubSub or actual client-library code written. If I remove the import, my application runs and does not crash. I have attempted to import in two different ways and get the same result:

const {PubSub} = require('@google-cloud/pubsub'); //from the google docs and import PubSub from '@google-cloud/pubsub'

For reference, my application runs on React and heavily uses Firebase for real time data syncing. I am looking to use Google Pub Sub to communicate notifications to the main console of the application, and notifications will be published by many different sub-components throughout the application.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
feywindcommented, Jun 23, 2020

I somehow totally missed the browser connection there. After a bit of internal discussion, we don’t actually support using this library from a browser, but it’s an aspiration. It looks like what’s happening here is that it’s failing to load protos via gax, which is pretty understandable. (I think they are dynamically require()'d in.) So I’m going to flip this from a question to a feature request for working webpack support.

2reactions
feywindcommented, May 27, 2020

@oaguilar5 @qstrahl Thanks for the report. There are some TypeScript incompatibilities that were introduced when we moved up to the latest minor in Pub/Sub 2.0.0. I wonder if there’s something going on there, but I’ll try to look at this after fixing that other issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: cannot import name pubsub_v1 - Stack Overflow
If i run $sudo pip install --upgrade google-cloud-pubsub then It is able to import pubsub but failing to import Bigquery. I need both...
Read more >
cannot import name 'pubsub_v1' from 'google.cloud' (unknown ...
The code deployment is successful, but the function is not working since the pubsub library is not getting loaded. The error is ImportError....
Read more >
Error Codes | Cloud Pub/Sub Documentation
Error HTTP Code Description UNAUTHENTICATED 401 The client is not authenticated properly. UNAVAILABLE 503 The service was unable to process a request.
Read more >
ImportError: cannot import name pubsub_v1 - A Cloud Guru
I get this error when I run transactions.py in my cloud shell. I tried updating the apt-get package etc as well, but no...
Read more >
@google-cloud/pubsub - npm
Imports the Google Cloud client library const {PubSub} ... Receive callbacks for errors on the subscription subscription.on('error', ...
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