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):
What I need (from Firebase Functions):
https://us-central1-[PROJECTID].cloudfunctions.net/[Google-FILE].html
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.