标签: firebase-cli

Firebase导入数据库而不触发函数

我们正在多个环境/阶段运行 Firebase。为了测试迁移,我们不断回滚,通过 CLI 导入数据库状态。问题是:我们的函数也被触发了。在这种情况下,我们只想更改数据库而不产生任何副作用。是否可以以任何方式休眠所有功能?

firebase firebase-realtime-database google-cloud-functions firebase-cli

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

Firebase cli 抛出错误:服务器错误。在每个命令上连接 ETIMEDOUT

我在堆栈溢出上检查了这个问题的所有答案。但所有这些都是由于其他原因而发生的。

好吧,我试图部署一些数据库规则并开始收到此错误。后来,当我尝试做任何事情时,我意识到所有 firebase 命令都不起作用,并且一次又一次地抛出相同的错误。

我尝试了什么:将 firebase 工具更新到最新版本重置我的互联网连接 firebase 登录 --reauth

但没有运气。

这是日志

[debug] [2018-12-25T05:41:52.644Z] ----------------------------------------------------------------------
[debug] [2018-12-25T05:41:52.648Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\user\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js list
[debug] [2018-12-25T05:41:52.649Z] CLI Version:   6.2.2
[debug] [2018-12-25T05:41:52.649Z] Platform:      win32
[debug] [2018-12-25T05:41:52.649Z] Node Version:  v8.12.0
[debug] [2018-12-25T05:41:52.650Z] Time:          Tue Dec 25 2018 11:11:52 GMT+0530 (India Standard Time)
[debug] [2018-12-25T05:41:52.650Z] ----------------------------------------------------------------------
[debug] 
[debug] [2018-12-25T05:41:52.673Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2018-12-25T05:41:52.674Z] > authorizing via signed-in user
[debug] [2018-12-25T05:41:52.677Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2018-12-25T05:41:52.678Z] >>> HTTP REQUEST …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-cli

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

从 firebase 中的文件导入环境变量

我知道我们可以在命令行中设置环境变量,如下所示:

firebase functions:config:set slack.id="XXXX" slack.secret="XXXX"
Run Code Online (Sandbox Code Playgroud)

但是如果我们有太多的环境变量需要设置,我们可以将其放入一个文件中并像这样导入:

firebase functions:config:set env_variables.json
Run Code Online (Sandbox Code Playgroud)

谢谢

firebase google-cloud-functions firebase-cli

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

如何使用 github 操作和 w9jds/firebase-action 部署到不同的 firebase 环境

我正在尝试使用 Github Actions 为我的 angular 项目设置 CI 到 firebase,但我有一个临时环境和生产环境,我想根据我推送到的分支部署到每个环境。

我知道我可以为我的masterdev分支创建两个不同的工作流脚本,但我无法弄清楚如何使用w9jds/firebase-action.

当我使用脚本时:

on:
  push:
    branches:
      - dev

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Install Dependencies
        run: npm install
      - name: Build
        run: npm run build-prod
      - name: Archive Production Artifact
        uses: actions/upload-artifact@master
        with:
          name: dist
          path: dist
  deploy:
    name: Deploy
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Download Artifact
        uses: …
Run Code Online (Sandbox Code Playgroud)

github firebase firebase-hosting firebase-cli github-actions

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

Firebase CLI 部署警告:Node.js 8 运行时已弃用,将于 2020-12-05 停用

我正在尝试学习如何将打字稿部署到我的 FCF 上,但它似乎没有像文档和 firecasts 的官方视频中那样进行部署。当我尝试部署 helloworld 的默认代码而不是 typescript 时,它正在部署 node.js 文件,我不明白为什么?下面是一些json文件和ts文件,请看一下那些生成的文件。

tsconfig.json
{
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": true,
    "target": "es2017"
  },
  "compileOnSave": true,
  "include": [
    "src"
  ]
}
Run Code Online (Sandbox Code Playgroud)
package.json
{
  "name": "functions",
  "scripts": {
    "lint": "./node_modules/.bin/tslint -p tslint.json",
    "build": "./node_modules/.bin/tsc",
    "serve": "npm run build && firebase emulators:start --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": { …
Run Code Online (Sandbox Code Playgroud)

firebase typescript google-cloud-functions firebase-cli

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

获取“HTTP 错误:404,未找到方法”。在 Firebase Cloud Functions 上运行“firebase deploy --only functions”时

几个小时以来,我一直被这个问题困扰,我想你们中的一个人之前可能遇到过它。

Error: HTTP Error: 404, Method not found.在运行时遇到了问题,firebase deploy --only functions因此无法部署上次更新。

  • 所有的Firebase Cloud Functions 项目都会发生这种情况

  • 我的 Firebase 托管不会发生这种情况

这是我添加时得到的--debug

firebase deploy --only functions:onBookingCreated --debug
[2020-08-25T15:18:37.029Z] ----------------------------------------------------------------------
[2020-08-25T15:18:37.032Z] Command:       /usr/local/Cellar/node/12.4.0/bin/node /usr/local/bin/firebase deploy --only functions:onBookingCreated --debug
[2020-08-25T15:18:37.032Z] CLI Version:   7.0.0
[2020-08-25T15:18:37.032Z] Platform:      darwin
[2020-08-25T15:18:37.032Z] Node Version:  v10.15.3
[2020-08-25T15:18:37.033Z] Time:          Tue Aug 25 2020 17:18:37 GMT+0200 (Central European Summer Time)
[2020-08-25T15:18:37.034Z] ----------------------------------------------------------------------

[2020-08-25T15:18:37.044Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2020-08-25T15:18:37.044Z] > authorizing via signed-in user
[2020-08-25T15:18:37.044Z] …
Run Code Online (Sandbox Code Playgroud)

google-cloud-functions firebase-cli

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

Firebase:无法添加新应用(错误消息:请求包含无效参数)

我正在尝试在 Firebase 中创建一个 Web 应用程序,以便我可以获得凭证,但它拒绝这样做。我无法在此错误消息中找到任何内容。

我收到错误状态“发生意外错误。[原因:请求包含无效参数。]” Firebase 中的错误消息


此外,当我尝试通过 CLI 创建它时,它拒绝

firebase apps:create WEB "Web app"
Run Code Online (Sandbox Code Playgroud)

结果是:

[debug] [2020-10-29T13:04:48.471Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Thu, 29 Oct 2020 13:04:48 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-Q050=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2020-10-29T13:04:48.472Z] <eye3 title='/ExecuteService.SingleExecute, INVALID_ARGUMENT'/> APPLICATION_ERROR;execute_service/ExecuteService.SingleExecute;Not a valid controlling product: FIREBASE. Property id:<188538656>
com.google.apps.framework.request.StatusException: <eye3 title='INVALID_ARGUMENT'/> generic::INVALID_ARGUMENT: Not a valid controlling product: FIREBASE. Property id:<188538656>;AppErrorCode=3;StartTimeMs=1603976687479;tcp;Deadline(sec)=30.0;ResFormat=UNCOMPRESSED;Originator=mobilesdk-devrel-frontend;Tag=IncomingMethod/FiredataInternalService.ProcessQueueMessage;ServerTimeSec=0.247247872;LogBytes=256;Non-FailFast;EndUserCredsRequested;EffSecLevel=privacy_and_integrity;ReqFormat=UNCOMPRESSED;ReqID=ae3e58762b9b13f4;GlobalID=6831ddc8c7f8475;Server=[2002:a81:9b16:0:b029:19c:c7d4:d379]:4001
[debug] [2020-10-29T13:04:48.476Z] FirebaseError: <eye3 title='/ExecuteService.SingleExecute, INVALID_ARGUMENT'/> APPLICATION_ERROR;execute_service/ExecuteService.SingleExecute;Not a valid controlling product: FIREBASE. Property id:<188538656>
com.google.apps.framework.request.StatusException: …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-cli

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

Firebase 部署不断给我一个错误:在 remoteconfig.template.json 中解析错误

我正在尝试使用 firebase 部署 Web 应用程序,但每次运行 deploy 时,我都会收到此错误

Error: Parse Error in remoteconfig.template.json:

No data, empty input at 1:1

^
File: "remoteconfig.template.json"
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-remote-config firebase-cli

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

Firebase Firestore 模拟器错误`已在 settings() 和 useEmulator() 中设置了主机,将使用模拟器主机`

首先,这是我得到的完整错误。

@firebase/firestore:Firestore (8.1.1):在 settings() 和 useEmulator() 中都设置了主机,将使用模拟器主机
错误 [FirebaseError]:Firestore 已经启动,无法再更改其设置。您只能在调用 Firestore 对象上的任何其他方法之前修改设置。

这就是我初始化模拟器的方式

const db = app.firestore();
const auth = firebase.auth();
if (process.env.NODE_ENV === 'development') {
  db.useEmulator('localhost', 8888);
  firebase.auth().useEmulator('http://localhost:9099/');
}
Run Code Online (Sandbox Code Playgroud)

当我第一次启动应用程序时,项目正在运行 nextjs 一切都按预期运行,但是在 next.js 页面之间刷新或导航后,我突然收到此错误。我必须杀死终端并重新开始,这很烦人我不知道 next.js 服务器是否多次运行if (process.env.NODE_ENV === 'development')代码,这可能是导致此错误的原因,如果是这种情况下如何避免在那里设置新模拟器已经是一个了。还是与 firebase 模拟器相关的错误?

firebase reactjs next.js google-cloud-firestore firebase-cli

5
推荐指数
2
解决办法
937
查看次数

Firebase CLI 部署错误:“部署到 Node.js 10 以下的运行时现在在 Firebase CLI 中已禁用。”

我有一个使用 Cloud Functions for Firebase 的项目,在将 Firebase CLI 更新到版本 9.0.0 后,我收到一条错误消息:

错误:functions 目录中的 package.json 有一个不受支持的引擎字段。有效的选择是:{"node": "10"}、{"node":"12"} 和 {"node":"14"}。

部署到 Node.js 10 以下的运行时现在在 Firebase CLI 中被禁用。现有的 Node.js 8 函数将在 2021-03-15 停止执行。尽快将现有函数更新到 Node.js 10 或更高版本。

我知道节点 8 现在不受支持,但我想继续在 Spark 付款计划上部署和运行我的功能,该计划在 2021 年 3 月 15 日关闭之前不需要计费。我该怎么做?

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

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