标签: firebase-cli

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

从服务帐户跨项目访问Firebase数据库

我有一个没有启用结算的Firebase项目.我想使用属于另一个启用计费的项目的VM创建数据库备份.备份脚本非常简单:

.npm/bin/firebase --project $PROJECT_ID database:get /
Run Code Online (Sandbox Code Playgroud)

将新创建的服务帐户分配给运行此脚本的VM(通过GCE).如果此帐户无权访问项目$PROJECT_ID,那么显然会失败:

Error: Authorization failed. This account is missing the following required permissions on project $PROJECT_ID:

firebase.projects.get
firebasedatabase.instances.get
Run Code Online (Sandbox Code Playgroud)

但是,将这些特定权限授予服务帐户,或者甚至将"所有者"角色分配给该项目并不会使它变得更好.代替:

Error: HTTP Error: 404, The specified project was not found.
Run Code Online (Sandbox Code Playgroud)

使用--debug专门GET https://admin.firebase.com/v1/projects/$PROJECT_ID返回404的节目运行.

该项目存在,我通过在我的工作站上使用我自己的(非服务)帐户运行完全相同的命令来验证.我还通过gcloud auth list在VM上运行来验证该帐户是否正确.该项目还显示在gcloud projects list同一VM上的输出中.

有没有办法让服务帐户跨项目工作并访问Firebase数据库?

firebase firebase-realtime-database firebase-cli

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

Firestore / Firebase模拟器未运行

我正在尝试使用此处列出的指南在本地测试我的功能 :https://firebase.google.com/docs/functions/local-emulator

我已经安装了最新的firebase-tools

npm install -g firebase-tools

在我package.json我确认正在运行

"firebase-admin": "^7.3.0",
"firebase-functions": "^2.3.1",
Run Code Online (Sandbox Code Playgroud)

当我尝试使用以下命令运行函数时

firebase emulators:start

它给了我下面的输出。我究竟做错了什么?

Starting emulators: ["functions"]
?  Your requested "node" version "8" doesn't match your global version "11"
?  functions: Emulator started at http://localhost:5001
i  functions: Watching "[FUNCTIONS FOLDER PATH]" for Cloud Functions...
?  Default "firebase-admin" instance created!
?  Ignoring trigger "[FUNCTION NAME]" because the service "firebaseauth.googleapis.com" is not yet supported.
?  Ignoring trigger "[FUNCTION NAME]" because the Cloud Firestore emulator is not running. …
Run Code Online (Sandbox Code Playgroud)

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

8
推荐指数
6
解决办法
5677
查看次数

多个 Firebase 项目 | 登录

我在 VScode 中有多个带有项目目录的客户项目,我可以在它们之间切换。这些都使用 Firebase 并拥有不同的 Firebase(即 Google 帐户)。

每次我切换我都必须

  1. firebase logout
  2. 切换到我希望连接的 Google/Firebase 帐户的活动 Chrome 窗口
  3. firebase login,这将在此 Chrome 实例中启动 auth。

有时很容易忘记 - 是否有一种简单的方法可以将 Google/Firebase 帐户链接到项目目录,以便在打开该目录时连接到该 Firebase 实例(没有多个笔记本电脑配置文件)?用 git with 可以指定目录配置文件中的设置。

只是有兴趣知道?

firebase firebase-cli

8
推荐指数
0
解决办法
266
查看次数

如何修复 fastlane-plugin-firebase_app_distribution 未定义

我正在尝试在本地系统上为 firebase 应用程序分发设置 CI-CD。

fastlane-plugin-firebase_app_distribution 找不到插件。

Error loading plugin 'fastlane-plugin-firebase_app_distribution': cannot load such file -- fastlane/plugin/firebase_app_distribution
+-------------------------------------------+-----------+------------------+
|                               Used plugins                               |
+-------------------------------------------+-----------+------------------+
| Plugin                                    | Version   | Action           |
+-------------------------------------------+-----------+------------------+
| fastlane-plugin-firebase_app_distribution | undefined | No actions found |
+-------------------------------------------+-----------+------------------+
Run Code Online (Sandbox Code Playgroud)

我该怎么办?

ios firebase fastlane firebase-cli

8
推荐指数
3
解决办法
4326
查看次数

如何解决 firebase 部署功能错误:云功能部署需要即用即付 (Blaze) 计费计划

(基础)macbooks-mbp:功能 macbook$firebase deploy

\n
=== Deploying to 'fir-project1-e0b25'...\n\ni  deploying functions\nRunning command: npm --prefix "$RESOURCE_DIR" run lint\n\n> functions@ lint /Users/macbook/fireCast/functions\n> tslint --project tsconfig.json\n
Run Code Online (Sandbox Code Playgroud)\n

运行命令:npm --prefix "$RESOURCE_DIR" run build

\n
> functions@ build /Users/macbook/fireCast/functions\n> tsc\n\n\xe2\x9c\x94  functions: Finished running predeploy script.\ni  functions: ensuring required API cloudfunctions.googleapis.com is enabled...\ni  functions: ensuring required API cloudbuild.googleapis.com is enabled...\n**\xe2\x9a\xa0  functions: missing required API cloudbuild.googleapis.com. Enabling now...**\n\xe2\x9c\x94  functions: required API cloudfunctions.googleapis.com is enabled\n\nError: Cloud Functions deployment requires the pay-as-you-go (Blaze) billing plan. To upgrade your …
Run Code Online (Sandbox Code Playgroud)

firebase google-cloud-functions firebase-cli

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

Node.js 应用程序的 firebase deploy 命令导致错误:`runtime` 字段是必需的,但在 firebase.json 中找不到

我正在尝试在 firebase 中部署我的 Node.js 应用程序,但是当我运行该命令时,它会导致Error: 运行时错误 field is required but was not found in firebase.json.

在此处输入图片说明

我尝试运行该命令,firebase serve --only functions,hosting并且在本地一切正常,因此我想部署并向我的同事提供链接以供用户测试,但我无法使用该firebase deploy命令执行此操作。

我尝试将命令添加到我的firebase.json文件中,但仍然没有运气。这是我的原始firebase.json文件:

{
  "hosting": {
    "public": "public",
    "rewrites": [
      {
        "source": "**",
        "function": "app"
      }
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

收到错误后,我改为:

{
  "hosting": {
    "public": "public",
    "runtime": "nodejs10",
    "rewrites": [
      {
        "source": "**",
        "function": "app"
      }
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

仍然出现错误,我有点困惑我到底需要在哪里添加命令"runtime": "nodejs10",。我试图寻找但找不到任何关于类似问题的相关文章,任何人都可以帮助我。

node.js firebase firebase-hosting google-cloud-functions firebase-cli

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

如何在 Firestore 模拟器中填充集合?

我有一个返回对象列表的函数,我需要某种方法,以便我可以在本地 Firestore 模拟器中填充这些数据,而不是在实际的云 Firestore 实例中。我怎样才能实现它?

firebase google-cloud-firestore firebase-cli

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

Firebase 错误..错误:无法向 https://www.gstatic.com/firebasejs/releases.json 发出请求

我正在将我的 React 应用程序部署到 firebase 托管。当我创建 firebase init 并选择所有选项时,我收到此错误。

C:\Users\user\git\Apps\screem>firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  C:\Users\user\git\Apps\screem

? Are you ready to proceed? Yes
? Which Firebase CLI …
Run Code Online (Sandbox Code Playgroud)

reactjs firebase-hosting firebase-cli

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

Flutterfire cli 未将 Windows 和 Linux 显示为支持平台的选项

我无法编译我的 flutter 应用程序,因为它没有为 Windows 配置,或者更确切地说,它没有为 Windows 配置 Firebase,因此应用程序启动但失败。我不明白为什么当我运行时flutterfire configure它会显示以下内容。

图像

windows dart firebase flutter firebase-cli

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