googlecodelabs / gcp-marketplace-integrated-saas

Apache License 2.0
19 stars 22 forks source link

[marketplace-integrated-saas]: create_subscription from https://developers.google.com/gcp-marketplace-saas#3 is out of date #14

Closed xavier-rbz closed 3 years ago

xavier-rbz commented 3 years ago

Preliminary steps: I created a fresh python venv, then installed prerequisites using pip install --upgrade google-api-python-client google-cloud google-cloud-pubsub.

In https://developers.google.com/gcp-marketplace-saas#3, the provided create_subscription.py doesn't work out of the box:

  1. it uses a programming API that seemingly doesn't exist anymore
    Traceback (most recent call last):
    File "create_subscription.py", line 61, in <module>
    main(sys.argv)
    File "create_subscription.py", line 38, in main
    topic_path = subscriber.topic_path(TOPIC_PROJECT,
  2. subscriber.create_subscription now requires the name and topic arguments to be passed as keywords: its signature is create_subscription(request: google.cloud.pubsub_v1.types.Subscription = None, *, name: str = None, topic: str = None, push_config: google.cloud.pubsub_v1.types.PushConfig = None, ack_deadline_seconds: int = None, retry: google.api_core.retry.Retry = <object object>, timeout: float = None, metadata: Sequence[Tuple[str, str]] = ()) according to https://googleapis.dev/python/pubsub/latest/subscriber/api/client.html#google.cloud.pubsub_v1.subscriber.client.Client.create_subscription

Cheers

tangbiao commented 3 years ago

May I know the python version you are using?

xavier-rbz commented 3 years ago

I'm using Python 3.8.6 on Linux

tangbiao commented 3 years ago

I was able to create a subscription by running python create_subscription.py. Though my python is 2.7.16. It seems the api is still working.

xavier, have you done the following steps as described in https://developers.google.com/gcp-marketplace-saas#1?

If you have, I am going to test it in a fresh python3 env.

tangbiao commented 3 years ago

I am going to close this issue since no response for 18 days. Please feel free to reopen it if you still face the same problem.

flebel commented 3 years ago

Pinning google-cloud-pubsub to 1.4.0 on Python 3.8 got me around the issue to run the one-off script.

tangbiao commented 3 years ago

Thank you flebel for sharing this.