Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloud Pub/Sub: HTTP URL is not registered even after domain is registered

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 !!

like image 885
Edmund Avatar asked Nov 27 '22 01:11

Edmund


1 Answers

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)
like image 67
Nebulastic Avatar answered Dec 20 '22 17:12

Nebulastic