Firebase Function如何调用区域实时数据库
Firebase Function how to call a region real time database
我正在努力解决一个问题:
我有一个在实时数据库上触发的云函数
.ref("/games/...")
.onWrite(async (change) => {
它在默认的实时数据库(亚洲)上运行良好,但在欧洲西部 1
所以我尝试了 functions.regions('europe-west1').database 但没有成功,我在网上找不到任何帮助。
感谢您的帮助
.region()
specifies where the Cloud function will run and has nothing to with database. You are probably looking for instance()
:
instance()
registers a function that triggers on events from a specific Firebase Realtime Database instance.
默认情况下 functions.database.ref
在没有 instance
的情况下使用会监视事件的 default 实例,这就是触发器适用于亚洲默认数据库的原因。
firebase.database.instance('my-app-db-2').ref('/foo/bar').onWrite(async (change) => {})
检查文档中的 'specify the instance and path' 部分。
我正在努力解决一个问题:
我有一个在实时数据库上触发的云函数
.ref("/games/...")
.onWrite(async (change) => {
它在默认的实时数据库(亚洲)上运行良好,但在欧洲西部 1
所以我尝试了 functions.regions('europe-west1').database 但没有成功,我在网上找不到任何帮助。
感谢您的帮助
.region()
specifies where the Cloud function will run and has nothing to with database. You are probably looking for instance()
:
instance()
registers a function that triggers on events from a specific Firebase Realtime Database instance.
默认情况下 functions.database.ref
在没有 instance
的情况下使用会监视事件的 default 实例,这就是触发器适用于亚洲默认数据库的原因。
firebase.database.instance('my-app-db-2').ref('/foo/bar').onWrite(async (change) => {})
检查文档中的 'specify the instance and path' 部分。