firebase - 如何验证 Firebase 函数?
问题描述
我想向 Google Cloud PubSub 推送订阅添加一个 webhook。我的 webhook url 端点是一个 Firebase 函数。要发布到我的 Firebase 端点,我必须验证域。
我的问题是 Firebase Functions 似乎没有办法静态托管单个网站。Firebase 托管发生在一个完全不同的域中。
我所拥有的(来自 Firebase 托管):
我需要什么(来自 Firebase Functions):
https://us-central1-[PROJECTID].cloudfunctions.net/[Google-FILE].html
解决方案
我通过express.static
在包含要在我的“./functions”目录中验证的 Google HTML 的文件夹上使用解决了这个问题。
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')));
然后部署您的功能。
推荐阅读
- javascript - 反应子状态不会使用父亲的道具更新(并且在分支中更深)
- python - PyQt5 和 PyOpenGL 的基础知识
- java - 如何在 JTree 中显示完整的文件路径?
- sql - 如何使用 Oracle 的 Toad 11g (SQL) 将一组实体(人)分成 10 个相等的部分,但基于它们对 EX 的使用
- c# - C# 如何在不使用 If 语句的情况下将一个标识符分配给多个子字符串?
- python - 将函数及其参数附加到列表而不立即调用该函数
- ssh - zsh completion: Disable ssh username completion
- mysql - 在节点js中一次从2个表中选择
- react-native - 当我什至不使用 TypeScript 时,为什么会收到一条错误消息,提示 Property assignment expected?
- python-3.x - AWS lambda No module named markupsafe error with jinja2