标签: firebase-tools

firebase cli:数据库规则-如何指定要应用的数据库

我正在开发一个项目,其中我使用 firebase 工具(firebase CLI)以编程方式创建多个实时数据库。我正在使用以下命令创建一个新数据库。

firebase 数据库:实例:创建

。我还想为新创建的数据库应用自定义规则。我从firebase CLI 文档中找到了以下命令

firebase部署——仅数据库

我有点害怕使用这个命令,因为我没有提到要更新的数据库的名称。如果有人可以帮助我了解 firebase CLI 如何选择要更新的数据库,我将非常感激。

firebase firebase-tools firebase-realtime-database firebase-cli

1
推荐指数
1
解决办法
859
查看次数

Cloud Functions 模拟器未在 Cloud Firestore 触发器上的 console.log() 上记录内容

我已成功运行 Firebase 模拟器:

E:\firebase>firebase emulators:start
i  emulators: Starting emulators: functions, firestore
!  Your requested "node" version "8" doesn't match your global version "10"
+  functions: Emulator started at http://localhost:5001
!  No Firestore rules file specified in firebase.json, using default rules.
i  firestore: Serving ALL traffic (including WebChannel) on http://localhost:808
0
!  firestore: Support for WebChannel on a separate port (8081) is DEPRECATED and
 will go away soon. Please use port above instead.
i  firestore: Emulator logging to firestore-debug.log
+  firestore: …
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform firebase-tools google-cloud-functions google-cloud-firestore firebase-cli

1
推荐指数
1
解决办法
4232
查看次数

Firebase 登录断言失败:new_time >= Loop->time,文件 c:\ws\deps\uv\src\win\core.c,第 309 行

我买了一台新的 Surface Laptop 3。我通常使用 MAC,但需要 Windows 来执行一些操作。我一直在使用并行,但决定硬着头皮买真正的 Windows 机器。

我使用 firebase 并安装了 firebase-tools 并运行良好。但是,当我尝试登录(使用firebase loginCLI 时),我不断收到如上所示的错误消息:Assertion failed: new_time >= loop->time, file c:\ws\deps\uv\src\win\core.c, line 309。我使用了 bash 和 powershell,结果相同。我还以管理员身份登录到 cmd 提示符。

我搜索了又搜索,发现了一些与时钟相关的东西并进行了检查。我还运行了一些文件系统检查等。但没有任何效果。在我的 Windows 10 环境中,在我的 MAC 上运行一切正常,但这款新笔记本电脑却无法处理。

有人能指出我正确的方向吗?

windows assertion firebase firebase-tools

1
推荐指数
1
解决办法
9514
查看次数

firebase服务,用于托管的模拟器端口?

我刚刚在 firebase.json 中添加了新的 Firebase 项目,其中包含以下内容:

  "emulators": {
    "functions": {
      "port": 5001
    },
    "hosting": {
      "port": 5002
    },
Run Code Online (Sandbox Code Playgroud)

我开始它与firebase serve. 它在端口 5000(而不是 5002)上提供托管服务:

+  hosting: Local server: http://localhost:5000
Run Code Online (Sandbox Code Playgroud)

难道我做错了什么?

localhost firebase-hosting firebase-tools

1
推荐指数
1
解决办法
1204
查看次数

运行 Firebase Deploy 尝试加载文件时出现 JSON 错误

部署到 firebase 时出现错误。我手动编辑.firebaserc文件以添加其他项目。

\n
$ firebase deploy --project staging --only hosting:admin\n\xe2\x9a\xa0  JSON error trying to load /some/path/to/.firebaserc\n
Run Code Online (Sandbox Code Playgroud)\n

.firebaserc

\n
{\n  "projects": {\n    "production": "myapp-8879",\n    "staging": "myapp-c8499"\n  },\n  "targets": {\n    "myapp-8879": {\n      "admin": [\n        "admin-app"\n      ],\n      "app": [\n        "myapp-8879"\n      ],\n    },\n    "myapp-c8499": {\n      "admin": [\n        "admin-app"\n      ],\n      "app": [\n        "myapp-c8499"\n      ]\n    }\n  }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

firebase firebase-hosting firebase-tools

1
推荐指数
1
解决办法
819
查看次数

无法从 CLI 初始化现有的 firebase 项目,因为它告诉我我没有启用 firestore

我正在使用 firebase CLI 从现有的 firebase 项目初始化本地 firebase 项目目录。这个现有项目确实有 100% 确定性的 firestore(其中有大量数据)。它绝对是 firestore 而不是实时数据库。

我在跑步..

firebase init firestore
Run Code Online (Sandbox Code Playgroud)

然后我从列表中选择现有项目,然后我得到......

Error: It looks like you haven't used Cloud Firestore in this project before. Go to https://console.firebase.google.com/project/some-project/firestore to create your Cloud Firestore database.
Run Code Online (Sandbox Code Playgroud)

这里是否存在潜在的权限问题?

firebase firebase-tools google-cloud-firestore

1
推荐指数
1
解决办法
1423
查看次数

firebase云函数内的模块与python:ModuleNotFoundError:没有名为“src”的模块

我有一个这样的目录结构:

python-functions/
--src
---- | api/
-------- | __init__.py
-------- | main.py
---- | __init__.py
---- | main.py
Run Code Online (Sandbox Code Playgroud)

我试图在 src/main.py 中定义所有函数,但在其相应的文件夹中有实现

python-functions/
--src
---- | api/
-------- | __init__.py
-------- | main.py
---- | __init__.py
---- | main.py
Run Code Online (Sandbox Code Playgroud)
# src/main.py
import src.api.main as api

@https_fn.on_request(timeout_sec=300)
def status(req: https_fn.Request) -> https_fn.Response:
    return api.status(req)
Run Code Online (Sandbox Code Playgroud)

但是在部署时我收到此错误:

# Importing like: import src
ModuleNotFoundError: No module named 'src'
127.0.0.1 - - [18/May/2023 00:09:43] "GET /\_\_/functions.yaml HTTP/1.1" 500 -
Error: Failed to parse build specification:

- …
Run Code Online (Sandbox Code Playgroud)

python firebase google-cloud-platform firebase-tools google-cloud-functions

1
推荐指数
1
解决办法
828
查看次数

如何将 Astro SSR 部署到 Firebase 托管

内容:
我希望构建一个 Astro SSR 项目并将其部署到 Firebase 托管。

问题/问题:

  1. Astro 需要安装适配器才能构建。我安装了节点适配器;这绝对不是正确的做法

  2. Firebase 托管文档表示它支持 SSR(下一个 JavaScript) -文档

  3. 不知道如何部署SSR。已经有一个云功能可以从 firestore 检索数据。

firebase-hosting firebase-tools astrojs

1
推荐指数
1
解决办法
1106
查看次数