I have a Google Pub/Sub project and created a topic and a simple subscription.
However, when specifying a URL for push, I keep getting the error below. I have completed the site verification process and registered the domain in APIs & services as described in https://cloud.google.com/pubsub/docs/push#other-endpoints:
ERROR: Failed to create subscription [projects/<project-id>/subscriptions/my-sub-2]: The supplied HTTP URL is not registered in the subscription's parent project (url="https://us-central1-<project-id>.cloudfunctions.net/xxxx", project_id="<project id number>").
ERROR: (gcloud.pubsub.subscriptions.create) Failed to create the following: [my-sub-2].
Please help !!
I walked into this issue numerous times, it is indeed really annoying. It is all about registering the ownership of the http endpoint. This way Google can verify that you are the owner of the supplied endpoint. Information on how to register the endpoint can be found here under domain ownership validation. I included this in my function so Google can verify the registration:
if request.method == 'GET':
return '''
<html>
<head>
<meta name="google-site-verification" content="{token}" />
</head>
<body>
</body>
</html>
'''.format(token=config.SITE_VERIFICATION_CODE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With