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: Quickstart examples for Pub/Sub subscriber not working #4394

Closed
Edo-A opened this issue Nov 14, 2017 · 5 comments
Closed

PubSub: Quickstart examples for Pub/Sub subscriber not working #4394

Edo-A opened this issue Nov 14, 2017 · 5 comments
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API. priority: p2 Moderately-important priority. Fix may not be included in next release.

Comments

@Edo-A
Copy link

Edo-A commented Nov 14, 2017

Subscription quickstart documentation for Pub/Sub library is not correct in a couple of points.

  1. The final subscription here should be subscription_name.

    subscription = subscriber.create_subscription(topic, subscription)

    Using it as is throws the following error: NameError: name 'subscription' is not defined

  2. After modifying the line from 1 above to

    subscription = subscriber.create_subscription(topic, subscription_name)

    it throws another error:

    Traceback (most recent call last):
      File "receive.py", line 19, in <module>
        subscription = subscriber.create_subscription(topic, subscription_name)
      File "/path-to-file/pubsub/env/local/lib/python2.7/site-packages/google/cloud/pubsub_v1/_gapic.py", line 42, in <lambda>
        fx = lambda self, *a, **kw: wrapped_fx(self.api, *a, **kw)
      File "/path-to-file/pubsub/env/local/lib/python2.7/site-packages/google/cloud/gapic/pubsub/v1/subscriber_client.py", line 445, in create_subscription
        return self._create_subscription(request, options)
      File "/path-to-file/pubsub/env/local/lib/python2.7/site-packages/google/gax/api_callable.py", line 452, in inner
        return api_caller(api_call, this_settings, request)
      File "/path-to-file/pubsub/env/local/lib/python2.7/site-packages/google/gax/api_callable.py", line 438, in base_caller
        return api_call(*args)
      File "/path-to-file/pubsub/env/local/lib/python2.7/site-packages/google/gax/api_callable.py", line 376, in inner
        return a_func(*args, **kwargs)
      File "/path-to-file/pubsub/env/local/lib/python2.7/site-packages/google/gax/retry.py", line 127, in inner
        ' classified as transient', exception)
    google.gax.errors.RetryError: RetryError(Exception occurred in retry method that was not classified as transient, caused by <_Rendezvous of RPC that terminated with (StatusCode.INVALID_ARGUMENT, Invalid resource name given (name=projects/PROJECTID/topics/TOPICNAME). Refer to https://cloud.google.com/pubsub/overview#names for more information.)>)

    Note that I've copied/pasted the code example and edited the projectID, topic name and subscription name to be valid for my project. Also note that using the example from readthedocs.io (which is the same) generates the exact same error

@dhermes dhermes added api: pubsub Issues related to the Pub/Sub API. documentation labels Nov 14, 2017
@dhermes
Copy link
Contributor

dhermes commented Nov 14, 2017

@jonparrott @lukesneeringer Do you know who owns those samples?

@theacodes
Copy link
Contributor

We do? Are they just the samples in the pubsub README?

@chemelnucfin chemelnucfin changed the title Quickstart examples for Pub/Sub subscriber not working PubSub: Quickstart examples for Pub/Sub subscriber not working Nov 14, 2017
@Edo-A
Copy link
Author

Edo-A commented Nov 15, 2017

yes and no, the sample on github is the README, but readthedocs.io contains the same information for issue 2

@tseaver tseaver added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Nov 15, 2017
@tseaver
Copy link
Contributor

tseaver commented Nov 15, 2017

The example reverses the order of arguments passed to 'subscriber.create_subscription'.

FWIW, the publisher example is borked too: it omits passing the topic name to publisher.create_topic.

@tseaver
Copy link
Contributor

tseaver commented Nov 15, 2017

@Edo-A Thanks very much for the report, BTW!

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. priority: p2 Moderately-important priority. Fix may not be included in next release.
Projects
None yet
Development

No branches or pull requests

4 participants