我正在集成 CI/CD 以部署我的 firebase 功能。
firebase use PROJECTID --token FIREBASE_TOKEN
firebase deploy --token FIREBASE_TOKEN --non-interactive
Run Code Online (Sandbox Code Playgroud)
现在,每当从 index.js 中删除一个函数时,它都会抛出以下异常。
错误:在您的项目中找到以下函数,但在您的本地源代码中不存在:httpSeeding(us-central1) 正在中止,因为删除无法在非交互模式下进行。要修复,请通过运行手动删除函数:firebase functions:delete httpSeding --region us-central1
在非交互模式下有没有办法在不运行的情况下从控制台中删除已删除的功能 firebase functions:delete httpSeeding?
firebase google-cloud-functions google-cloud-firestore firebase-cli
我试图在Windows 10上使用firebase functions:shell在本地运行的Firebase Cloud Function中的Node.js v8.4.0上使用Firebase Admin访问Firestore。
火力基地-v 4.2.1
"dependencies": {
"firebase-admin": "^6.0.0",
"firebase-functions": "^2.0.5"
}
Run Code Online (Sandbox Code Playgroud)
从我的应用程序代码尝试使用firebase admin之后,我尝试在https://github.com/firebase/functions-samples/blob/master/quickstarts/uppercase-firestore/functions/index.js中运行快速入门示例。
这是实际的代码运行:
'use strict';
// [START all]
// [START import]
// The Cloud Functions for Firebase SDK to create Cloud Functions and setup triggers.
const functions = require('firebase-functions');
// The Firebase Admin SDK to access the Firebase Realtime Database.
const admin = require('firebase-admin');
admin.initializeApp({})
// [END import]
// [START addMessage]
// Take the text parameter passed to this HTTP endpoint and …Run Code Online (Sandbox Code Playgroud) node.js firebase google-cloud-functions google-cloud-firestore firebase-cli
我目前正在youtube 上关注本教程,大约 26 分钟时,作者正在使用该firebase serve命令在本地运行他的功能。
这对他来说很好,但是一旦我尝试这样做,我就会收到下一个错误:
Run Code Online (Sandbox Code Playgroud)Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information. at GoogleAuth.getApplicationDefaultAsync (D:\\...\functions\node_modules\google-auth-library\build\src\auth\googleauth.js:161:19) at process._tickCallback (internal/process/next_tick.js:68:7)
现在,错误给了我一个链接,通过在我的 Windows 中设置一个环境变量来帮助我解决这个错误(我不喜欢,因为当我在链接到的不同项目中开发时,这将如何工作?不同的 Gmail 帐户?)
我发现但尚未测试的另一个解决方案是使用 gcloud 命令在本地进行身份验证gcloud auth application-default login。
这些步骤都不是作者在教程中完成的。
我在视频的评论中搜索,有人提到它与 firebase-tools 版本有关。他的解决方案是回到 firebase-tools 版本 6.8.0,而当前最新版本是 7.2.2。
所以我想知道,当使用 firebase-tools 6.8 时,当云函数尝试在远程 firestore 数据库中存储一些东西时,firebase 与 firebase-tools 7.2.2 一起服务的变化无法再运行云函数。 0?
它是否会像使用 6.8.0 版本那样使用 7.2.2 或更高版本?
我通过以下代码安装 Firebase CLI (firebase-tools) https://github.com/firebase/firebase-tools:
curl -sL firebase.tools | bash
Run Code Online (Sandbox Code Playgroud)
如何彻底卸载?
我忘记从终端中的 Firebase 帐户注销并在继续之前更改帐户firebase init,我使用旧帐户为新项目创建了一个 Firebase 函数,我回去删除了包括 xcworkspace 在内的文件,然后运行 pod install 并创建了一个新的工作区,当我想firebase init再次运行时,它说
MooMyeongs-MacBook-Pro:Doshirak moomyeong$ firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
/Users/moomyeong/Desktop/Desktop/Applications/Doshirak
? …Run Code Online (Sandbox Code Playgroud) 我在 >Firebase >Hosting >Main 中有两个 Firebase 托管站点(https://console.firebase.google.com/u/0/project/example/hosting/main)
1. **foobar**.web.app (default project from setup process)
2. **example**.web.app (added as an additional web app under the main project and linked for hosting)
Run Code Online (Sandbox Code Playgroud)
这些是我的.firebaserc设置:
{
"targets": {
"foobar": {
"hosting": {
"foobar": [
"foobarWebApp"
]
}
},
"example": {
"hosting": {
"foobar": [
"foobarWebApp"
],
"example": [
"foobar"
]
}
}
},
"projects": {
"default": "foobar"
}
}
Run Code Online (Sandbox Code Playgroud)
从Firebase CLI运行firebase deploy后,文件将部署到foobar .web.app。如何将其更改为示例 …
我试图使用 firebase cli 部署我的第一个 firebase 云函数,但我遇到了一个错误:
C:\Users\Anurag Tripathi\Desktop\firebasecloudfunction> firebase deploy --only functions
Error: Missing permissions required for functions deploy. You must have permission iam.serviceAccounts.ActAs on service account project_number@appspot.gserviceaccount.com.
To address this error, ask a project Owner to assign your account the "Service Account User" role from this URL:
https://console.cloud.google.com/iam-admin/iam?project=project_number
Run Code Online (Sandbox Code Playgroud)
我试图按照说明解决问题,但没有成功。请帮忙。
firebase firebase-realtime-database google-cloud-functions firebase-cli
我目前有一个通过 VueCLI 和 firebase-tools 设置的项目,但似乎无法在本地将 Firebase Auth 模拟器附加到我的项目。
我的 Firebase 设置文件:
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';
import 'firebase/storage';
const configOptions = {
apiKey: process.env.VUE_APP_FIREBASE_API_KEY,
authDomain: process.env.VUE_APP_FIREBASE_AUTH_DOMAIN,
databaseURL: process.env.VUE_APP_FIREBASE_DB_URL,
projectId: process.env.VUE_APP_FIREBASE_PROJECT_ID,
storageBucket: process.env.VUE_APP_FIREBASE_STORAGE_BUCKET,
messagingSenderId: process.env.VUE_APP_FIREBASE_MESSAGING_SENDER_ID,
appId: process.env.VUE_APP_FIREBASE_APP_ID,
measurementId: process.env.VUE_APP_FIREBASE_MEASUREMENT_ID
};
firebase.initializeApp(configOptions);
if (process.env.NODE_ENV === "development"){
firebase.firestore().settings({ host: 'localhost:8080', ssl: false });
firebase.auth().useEmulator('http://localhost:9099/');
}
export const firebaseauth = firebase.auth();
export const firestore = firebase.firestore();
export const firebasestorage = firebase.storage();
export default firebase;
Run Code Online (Sandbox Code Playgroud)
我的 .env.development 文件
VUE_APP_I18N_LOCALE=en
VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_FIREBASE_API_KEY="xx"
VUE_APP_FIREBASE_AUTH_DOMAIN="localhost:9099" …Run Code Online (Sandbox Code Playgroud) 我在堆栈溢出上检查了这个问题的所有答案。但所有这些都是由于其他原因而发生的。
好吧,我试图部署一些数据库规则并开始收到此错误。后来,当我尝试做任何事情时,我意识到所有 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/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