Firebase 云函数模拟器在 30000 毫秒后超时

Fez*_*sta 7 firebase google-cloud-functions

我正在尝试运行firebase emulators:starts使用 Cloud Functions 的项目。

\n\n

它在端口 5001 启动本地服务器,如果我在 Chrome 中打开它,我会收到响应{ "status": "alive" },但 30 秒后它会因“超时”而自行关闭。

\n\n
\xe2\x9c\x94  functions: Emulator started at http://localhost:5001\ni  Shutting down emulators.\ni  Stopping functions emulator\n\nError: TIMEOUT: Port 5001 was not active within 30000ms\n
Run Code Online (Sandbox Code Playgroud)\n\n

该项目部署到 Google Cloud 后工作正常,那么问题出在哪里呢?

\n\n

我尝试运行它,sudo但没有帮助。

\n\n

我使用的是带有 WSL (Ubuntu) 的 Windows 10。

\n

Sai*_*eem 13

正如此评论中所讨论的,设置为我解决了这个问题"host": "127.0.0.1"firebase.json

firebas.json 应该看起来像这样。

{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "emulators": {
    "firestore": {
      "port": 5000,
      "host": "127.0.0.1"

    },
    "ui": {
      "enabled": true
    }
  }
}
Run Code Online (Sandbox Code Playgroud)


小智 0

--no-localhost使用任何选项firebase emulatorfirebase serve 检查firebase login https://firebase.google.com/docs/cli#sign-in-test-cli上的此注释 ,但我检查过,如果使用 WSL,这适用于所有命令