是否有一种方法来指定我的firebase函数将部署的区域/区域。
实际上,我在文档中没有找到任何关于它的东西,我的函数总是部署到us-central1
,但我想把它部署到eu-central1
上。
是否可以在Firebase - Config - File中设置它?
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "public",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
我也看了一下cli选项,但我没有发现任何东西在那里。
Firebase项目本身被正确地设置为欧洲区域o.O
6条答案
按热度按时间hc2pp10m1#
更新(2018-07-25):
现在可以在Firebase中为您的云函数指定区域,您可以在代码中指定该区域并部署更改。例如:
有关完整的细节,请参阅Firebase documentation on Cloud Functions locations(我从上面得到的代码片段)和修改部署函数的区域。
lrpiutwd2#
来源:https://firebase.google.com/docs/functions/locations
现已在以下地区提供:
变更地域的最佳实践
xwmevbvl3#
要为所有函数使用相同的自定义区域,请执行如下操作。
0aydgbwb4#
要使部署到区域的Firebase函数也能在本地仿真中工作,必须初始化客户端如下:
也就是说,代码是“不”相同的。在模拟案例中添加一个区域会使调用丢失,而不会出错。
LOCAL
是一个客户端值,我已经知道,后端是在云中运行,还是设置为本地仿真。这是一个火的故事,火的故事,火的故事。
firebase-tools 8.6.0,
firebase
7.16.1附录:
以上是针对浏览器的(没有说明)。我已经停止使用
httpsCallable
s,因为它们需要在线连接。另一方面,通过Firebase数据库进行接口是离线友好的,因此导致更强大的系统。hk8txs485#
如果您正在使用新的Firebase模块化SDK,请尝试以下操作:
可用区域集可在此处找到:https://firebase.google.com/docs/functions/locations#supported_regions
nhaq1z216#