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.

Migrating google-cloud-pubsub based code from 0.25 to 0.32

See original GitHub issue

I have some code that uses google-cloud-pubsub in version 0.25 and is run on Kubernetes and minikube locally. I’m trying to update the code to be compatible with latest package version but I have some problems with configuration when running in minikube.

Old version created the pubsub client in development like this:

with utils.EnvironmentContext('PUBSUB_EMULATOR_HOST', 'dev-pubsub:8042'):
    return pubsub.Client(_http=httplib2.Http(), _use_grpc=False)

But in 0.32 PublisherClient nor SubscriberClient don’t have those kwargs. There is GOOGLE_CLOUD_DISABLE_GRPC env variable that can be set (to a string and not a bool?) but still when I try to use my service it looks like it’s trying to authenticate via gRPC:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/grpc/_plugin_wrapping.py", line 77, in __call__
    callback_state, callback))
  File "/usr/local/lib/python3.6/site-packages/google/auth/transport/grpc.py", line 77, in __call__
    callback(self._get_authorization_headers(context), None)
  File "/usr/local/lib/python3.6/site-packages/google/auth/transport/grpc.py", line 65, in _get_authorization_headers
    headers)
  File "/usr/local/lib/python3.6/site-packages/google/auth/credentials.py", line 121, in before_request
    self.refresh(request)
  File "/usr/local/lib/python3.6/site-packages/google/oauth2/service_account.py", line 322, in refresh
    request, self._token_uri, assertion)
  File "/usr/local/lib/python3.6/site-packages/google/oauth2/_client.py", line 145, in jwt_grant
    response_data = _token_endpoint_request(request, token_uri, body)
  File "/usr/local/lib/python3.6/site-packages/google/oauth2/_client.py", line 111, in _token_endpoint_request
    _handle_error_response(response_body)
  File "/usr/local/lib/python3.6/site-packages/google/oauth2/_client.py", line 61, in _handle_error_response
    error_details, response_body)
google.auth.exceptions.RefreshError: ('invalid_client: The OAuth client was not found.', '{\n  "error" : "invalid_client",\n  "error_description" : "The OAuth client was not found."\n}')

What’s the correct way to handle dev configuration for 0.32? (was working ok for 0.25)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gcbirzancommented, Mar 19, 2018

As a note, everything after 0.28.0 requires GRPC so those arguments don’t make any sense. But, the emulator (if recent enough, I guess?) should work with the new version.

0reactions
theacodescommented, Mar 20, 2018

Cool, it seems we can close this. Let me know if there’s anything else to be done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pub/Sub quotas and limits - Google Cloud
Google Cloud uses quotas to restrict how much of a particular shared Google Cloud resource that you can use. Each quota represents a...
Read more >
Migrating App Engine pull tasks to Cloud Pub/Sub (Module 19)
Serverless Migration Station is a Serverless Expeditions mini-series focused on helping developers modernize their applications running on a ...
Read more >
google-cloud-pubsub - PyPI
Google Cloud Pub / Sub is a fully-managed real-time messaging service that allows you to send and receive messages between independent applications.
Read more >
@google-cloud/pubsub | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Getting Started | Messaging with Google Cloud Pub/Sub - Spring
Either way, you end up with working code. To start from scratch, move on to Build with Gradle. To skip the basics, do...
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