FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

pubsub can't infer a connection when running locally. · Issue #916 · googleapis/google-cloud-python · GitHub

pubsub can't infer a connection when running locally. #916

Description

When running locally with gcloud auth providing application default credentials, pubsub is unable to infer a connection, so this will fail:

import pubsub
pubsub.set_default_project('my-project-id')
topic = pubsub.Topic('my-topic')
topic.publish(...)

with EnvironmentError: Connection could not be inferred.

The fix is to set an explicit connection using adc:

credentials = GoogleCredentials.get_application_default()
pubsub.set_default_connection(pubsub.Connection(credentials))

However, storage and datastore do not have this issue. It seems unnecessarily to do this just for pubsub.

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


Back | FazBrowse Home | New Git URL