在文档中
https://firebase.google.com/docs/firestore/security/get-started#use_the_firebase_cli
我知道我可以使用以下方法部署规则
firebase deploy --only firestore:rules
Run Code Online (Sandbox Code Playgroud)
有没有办法让我指定规则文件的位置?
我有一个没有启用结算的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数据库?
我正在尝试使用此处列出的指南在本地测试我的功能 :https://firebase.google.com/docs/functions/local-emulator
我已经安装了最新的firebase-tools
npm install -g firebase-tools
在我package.json我确认正在运行
Run Code Online (Sandbox Code Playgroud)"firebase-admin": "^7.3.0", "firebase-functions": "^2.3.1",
当我尝试使用以下命令运行函数时
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
我在 VScode 中有多个带有项目目录的客户项目,我可以在它们之间切换。这些都使用 Firebase 并拥有不同的 Firebase(即 Google 帐户)。
每次我切换我都必须
firebase logoutfirebase login,这将在此 Chrome 实例中启动 auth。有时很容易忘记 - 是否有一种简单的方法可以将 Google/Firebase 帐户链接到项目目录,以便在打开该目录时连接到该 Firebase 实例(没有多个笔记本电脑配置文件)?用 git with 可以指定目录配置文件中的设置。
只是有兴趣知道?
我正在尝试在本地系统上为 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)
我该怎么办?
(基础)macbooks-mbp:功能 macbook$firebase deploy
=== 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\nRun Code Online (Sandbox Code Playgroud)\n运行命令:npm --prefix "$RESOURCE_DIR" run build
> 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 中部署我的 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
我有一个返回对象列表的函数,我需要某种方法,以便我可以在本地 Firestore 模拟器中填充这些数据,而不是在实际的云 Firestore 实例中。我怎样才能实现它?
我正在将我的 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) 我无法编译我的 flutter 应用程序,因为它没有为 Windows 配置,或者更确切地说,它没有为 Windows 配置 Firebase,因此应用程序启动但失败。我不明白为什么当我运行时flutterfire configure它会显示以下内容。
