【发布时间】:2021-03-05 20:21:59
【问题描述】:
我刚刚将 Express 与 Firebase Cloud Functions 一起使用并创建了一个端点。
app.get('/time', (req, res) => {
const date = new Date();
const hours = (date.getHours() % 12) + 1; // London is UTC + 1hr;
res.json({bongs: 'BONG '.repeat(hours)});
});
端点可通过以下路径公开访问:
https://<region>-<project-name>.cloudfunctions.net/app/time
app 来自入口源 index.js:
exports.app = functions.region('asia-east2').https.onRequest(app);
但是,它无法通过路径访问:
https://<project-name>.web.app/app/time
默认情况下,它需要我授予权限并选择我的 Google 帐户。怎么会?端点供公众访问。
我是否错过了任何设置以及如何解决此问题?
如果我不使用 Express Framework,以上 2 条路径都可供公众访问。 (即从您的应用调用函数,https://firebase.google.com/docs/functions/callable)
谢谢~
【问题讨论】:
标签: firebase google-cloud-functions