【问题标题】:debugging firebase on local windows在本地窗口上调试 firebase
【发布时间】:2019-10-06 11:54:09
【问题描述】:

我正在尝试在本地窗口上调试 firebase 功能

https://medium.com/@mwebler/debugging-firebase-functions-with-vs-code-3afab528bb36中所述

我愿意

set FIREBASE_CONFIG={  databaseURL: 'https://invoice-manager-251609.firebaseio.com',  storageBucket: 'invoice-manager-251609.appspot.com',   projectId: 'invoice-manager-251609'}

functions start

得到

┌────────┬────────┬─────────┬─────────────────────────────────────────────────────────────────┐
│ Status │ Name   │ Trigger │ Resource                                                        │
├────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────┤
│ FAILED │ upload │ HTTP    │ http://localhost:8010/invoice-manager-251609/us-central1/upload │
├────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────┤
│ FAILED │ tst    │ HTTP    │ http://localhost:8010/invoice-manager-251609/us-central1/tst    │
├────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────┤
│ FAILED │ tst1   │ HTTP    │ http://localhost:8010/invoice-manager-251609/us-central1/tst1   │
└────────┴────────┴─────────┴─────────────────────────────────────────────────────────────────┘

如果我这样做 firebase emulators:start

我明白了

undefinedWarning,根据 GCLOUD_PROJECT 估计 Firebase 配置。

初始化 firebase-admin 可能会失败[2019-10-06T11:44:51.932Z] @firebase/database:FIREBASE 致命错误:无法解析 Firebase 网址。

请使用 https://.firebaseio.com

我也试过了:

functions debug tst1

得到:

错误:函数工作者崩溃并退出代码:9 未定义(节点:21096)[DEP0062] 弃用警告:`node --debug

node --debug-brkare invalid. Please usenode --inspectornode --inspect-brk` 代替。

我试过node-10and node-8

我也试过这个: https://medium.com/@david_mccoy/build-and-debug-firebase-functions-in-vscode-73efb76166cf

还有这个 https://rominirani.com/google-cloud-functions-tutorial-debugging-local-functions-357c24829198

我遇到同样的错误

怎么了?

如何在本地窗口上调试 firebase?

【问题讨论】:

  • 我不相信当前的 Firebase 模拟器套件支持调试功能。那个教程有点老了。如果您在使用模拟器时遇到问题,请在 GitHub 上发布问题。 github.com/firebase/firebase-tools
  • 这是不正确的:我能够通过 devTool 逐步调试在我的本地窗口上使用 Firebase 模拟器调试功能

标签: firebase google-cloud-functions firebase-tools


【解决方案1】:

问题中的指南是正确的,但是 在模拟器中运行时,您必须手动设置 db url

admin.initializeApp({
    databaseURL: "https://<YOUR FIREBASE>.firebaseio.com"
  });

这里是完整的 cmd 列表:

functions start

functions deploy --trigger-http --timeout 600s funcName

functions inspect funcName

之后你可以使用chrome://inspect/ 连接到带有chrome调试器的进程。

如果你有问题,你可以使用:

functions logs read

注意:在functions start 之后,我仍然得到FAILED 状态的表 - 我忽略它

【讨论】:

    猜你喜欢
    • 2020-03-07
    • 2018-12-18
    • 1970-01-01
    • 1970-01-01
    • 2021-05-11
    • 2023-01-27
    • 2018-08-17
    • 2011-10-23
    • 1970-01-01
    相关资源
    最近更新 更多