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

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

Closed
theacodes opened this issue Jun 8, 2015 · 5 comments
Closed

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

theacodes opened this issue Jun 8, 2015 · 5 comments
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API.

Comments

@theacodes
Copy link
Contributor

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.

@dhermes
Copy link
Contributor

dhermes commented Jun 8, 2015

@jonparrott This is a known issue, but becomes moot via #910

@theacodes
Copy link
Contributor Author

Gotcha. Subscribed to #910 and will keep an eye on it.

@dhermes
Copy link
Contributor

dhermes commented Jun 8, 2015

Yeah. After #861 it's very possible that _implicit_environ will all be removed and you'll need to create an explicit client. However, the constructors will have nice defaults just like set_default_* do.

@dhermes
Copy link
Contributor

dhermes commented Jun 18, 2015

#910 made this moot.

@dhermes dhermes closed this as completed Jun 18, 2015
@theacodes
Copy link
Contributor Author

confirmed, the new client method only needs the project id. Thanks!

@dhermes dhermes added the api: pubsub Issues related to the Pub/Sub API. label Dec 31, 2015
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 Pub/Sub API.
Projects
None yet
Development

No branches or pull requests

2 participants