【发布时间】:2020-03-07 13:54:43
【问题描述】:
见下文,我的代码非常简单....它在实时数据库中侦听数据库字段的更改。
const functions = require("firebase-functions");
var admin = require("firebase-admin");
exports.onActiveUpdate = functions.database
.ref("/profiles/users/{userId}/active")
.onUpdate((change, context) => {
//code here
return true;
});
我尝试使用以下命令在本地调试代码
firebase serve --only functions
firebase serve
firebase emulators:start
我总是收到相同的信息...
+ functions: Emulator started at http://localhost:5001
i functions: Watching "C:\code\rn\xs\fb_functions\functions" for Cloud Functions...
i functions[onActiveUpdate]: function ignored because the database emulator does not exist or is not running.
+ All emulators started, it is now safe to connect.
但是当我转到 localhost:5001....时,我看到的只是一个空白页面,顶部带有 {"status":"alive"}。
这是正确的行为吗? 谢谢
【问题讨论】:
-
这能回答你的问题吗? Functions debugging in VS Code
标签: debugging firebase-realtime-database google-cloud-functions firebase-cli