您如何验证Firebase功能?

时间:2018-11-21 01:00:19

标签: firebase google-cloud-platform firebase-hosting google-cloud-pubsub

我想将一个Webhook添加到Google Cloud PubSub推送订阅中。我的webhook网址端点是Firebase函数。要发布到Firebase端点,我必须验证域。

我的问题是Firebase Functions似乎无法静态托管单个网站。 Firebase托管发生在完全不同的域中。

拥有的(来自Firebase托管):

  

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

需要(来自Firebase Functions):

  

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

1 个答案:

答案 0 :(得分:0)

我通过在包含“ ./functions”目录中要验证的Google HTML的文件夹上使用express.static解决了这一问题。

Google确实应该考虑允许其静态站点托管有选择地部署到功能域中的指定路由,而不是纯粹通过单独的域。

类似以下内容:

...
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')));

然后部署您的功能。

相关问题