【发布时间】:2020-02-21 20:05:07
【问题描述】:
我已经为我的 Flutter 应用部署了一个 谷歌云功能,以便在将新节点插入到 firebase 实时数据库但它不起作用时向给定用户发送推送通知,所以 我决定使用 VS Code 调试函数,我在 Windows 机器上使用它来开发 Flutter 应用程序。
因此,我按照教程执行了一系列步骤,所有步骤都在终端中,并且我连接到了本地版本的数据库 - 我被告知调试器是 监听 9229 端口。所以我看不到真正的数据库数据,看起来是空的。在没有找到解决方案的测试之后,我想再次使用真实数据,所以我尝试停止功能并卸载谷歌云功能模拟器,但 我仍然看不到任何数据库数据。
所以问题是:我怎样才能再次连接到服务器上的实时数据库?
如果有助于诊断问题,我遵循的步骤如下:
-在项目文件夹中:
npm install -g @google-cloud/functions-emulator
-然后在functions文件夹中:
firebase setup:web
节点
console.log(JSON.stringify(JSON.stringify({
"databaseURL": "https://YOUR-FIREBASE-PROJECT.firebaseio.com",
"storageBucket": "YOUR-FIREBASE-PROJECT.appspot.com",
"projectId": "YOUR-FIREBASE-PROJECT"
}))) //using my own data
functions start
set FIREBASE_CONFIG="{\"databaseURL\":\"https://YOUR-FIREBASE-PROJECT.firebaseio.com\",\"storageBucket\":\"YOUR-FIREBASE-PROJECT.appspot.com\",\"projectId\":\"YOUR-FIREBASE-PROJECT\"}" //using my own data here too
functions deploy --trigger-http --timeout 600s YOUR_FUNCTION_NAME //using my function name
functions debug myFunction
然后我得到:
Debugger for myFunction listening on port 9229.
然后在 .vscode\launch.json 我添加了:
{
"type": "node",
"request": "attach",
"name": "Attach Firebase",
"port": 9229,
"preLaunchTask": "Google Cloud Emulator"
}
...
然后我试图退出,所以我进入了:
-在functions文件夹中:
functions stop
-在项目文件夹中:
npm uninstall -g @google-cloud/functions-emulator
...
我还没有看到 firebase 实时数据库数据。
【问题讨论】:
标签: firebase-realtime-database google-cloud-functions firebase-tools