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 ValueError: Project from client (A) should agree with project from resource(B). #1828

Closed
tarzanjw opened this issue May 27, 2016 · 2 comments
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API.

Comments

@tarzanjw
Copy link

Say that I have 2 projects, A and B.

From project A, I have topics: projects/A/topics/events.
From project B, I add a subscription to above topic, subscription name is: projects/B/subscriptions/on-A-events.

Note: I created the subscription via Graph API Explorer, not via the Cloud Console (just can't do it with Cloud Console)

So, these code will raise an Exception:

  from gcloud import pubsub

  c = pubsub.Client(project='A')
  t = c.topic('events')
  subs = t.list_subscriptions()  # Error
  Traceback (most recent call last):
    File "<input>", line 1, in <module>
    File "<input>", line 1, in <listcomp>
    File ".../site-packages/gcloud-0.14.0-py3.5.egg/gcloud/pubsub/topic.py", line 311, in list_subscriptions
      sub_name = subscription_name_from_path(sub_path, self.project)
    File "../site-packages/gcloud-0.14.0-py3.5.egg/gcloud/pubsub/_helpers.py", line 73, in subscription_name_from_path
      return _name_from_project_path(path, project, _SUBSCRIPTION_TEMPLATE)
    File ".../site-packages/gcloud-0.14.0-py3.5.egg/gcloud/_helpers.py", line 464, in _name_from_project_path
      'project from resource(%s).' % (project, found_project))
  ValueError: Project from client (A) should agree with project from resource(B).

I take a dive into the source codes, and I see that you guys are assuming that every subscriptions that returned have to be in same project with the client, but it's not in my case.

Is it a bug or my misunderstanding?

@tarzanjw
Copy link
Author

Someone please delete this issue for me, just a duplicate submit with #1827

@tseaver
Copy link
Contributor

tseaver commented May 27, 2016

@tarzanjw sorry, ght Github UI doesn't support deleting issues.

@dhermes dhermes added the api: pubsub Issues related to the Pub/Sub API. label Jun 11, 2016
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

3 participants