Rap*_* St 4 firebase google-cloud-functions
我将云函数的位置从“us-central1”更改为“europe-west1”,但我无法在客户端更改我的函数的位置,这是它根据文档工作的强制性步骤。
(IDE 告诉我,当我这样做时,“函数”不会有任何参数:
firebase.initializeApp(config).functions("europe-west1");
Run Code Online (Sandbox Code Playgroud)
为了解决我的问题,我更新了下面的三个依赖项,但没有结果。
firebase-tools@latest firebase-functions@latest firebase-admin@latest
问题仍然在这里。
您应该访问以下文档页面。
使用 firebase.app.App。
https://firebase.google.com/docs/reference/js/firebase.app.App#functions
不是 admin.app.App。firebase-admin 仅在服务器端使用。
https://firebase.google.com/docs/reference/admin/node/admin.app.App
为客户端应用设置指定区域。
var firebase = require("firebase/app");
require("firebase/functions");
var config = {
// ...
};
firebase.initializeApp(config).;
var functions = firebase.app().functions('europe-west1');
Run Code Online (Sandbox Code Playgroud)
为每个函数设置指定的区域。
const functions = require('firebase-functions');
exports.webhookEurope = functions
.region('europe-west1')
.https.onRequest((req, res) => {
res.send("Hello");
});
Run Code Online (Sandbox Code Playgroud)
如果您要更改处理生产流量的函数的指定区域,您可以通过按顺序执行以下步骤来防止事件丢失:
- 重命名函数,并根据需要更改其区域。
- 部署重命名的函数,这会导致在两组区域中临时运行相同的代码。
- 删除之前的函数。
| 归档时间: |
|
| 查看次数: |
2764 次 |
| 最近记录: |