1
votes

I'd like to add a webhook to a Google Cloud PubSub push subscription. My endpoint for the webhook url is a Firebase Function. To post to my Firebase endpoint, I must verify the domain.

My problem is that Firebase Functions don't seem to have a way to statically host a single website. Firebase hosting happens in an entirely different domain.

What I have (from Firebase Hosting):

https://[PROJECT-ID].firebaseapp.com/[GOOGLE-FILE].html

What I need (from Firebase Functions):

https://us-central1-[PROJECTID].cloudfunctions.net/[Google-FILE].html

1
What are you looking at that suggests pubsub triggers require domain verification? I've been able to set up and use pubsub triggers in Cloud Functions without any hassle (other than activating billing, as required). - Doug Stevenson
A pull subscription requires domain verification. - Jefftopia
Are you trying to set up a function to get triggered whenever a message lands in a pubsub topic? Share some code? - Doug Stevenson
Ok, your question states pubsub in both the text and the tag. You may want to consider rewriting it. Or, actually use pubsub which should be much easier. - Doug Stevenson

1 Answers

1
votes

I solved this by using express.static on a folder containing Google's HTML to be verified in my "./functions" directory.

Google really ought to consider allowing their static site hosting to optionally deploy to a specified route in a functions domain, rather than purely through a separate domain.

Something like the following:

...
constructor() {
    this.express = express();

    // place your google verification HMTL file in the directory to expose
    // in my case, 'www'
    this.express.use(express.static(join(__dirname, '../..', 'www')));

Then deploy your function.