我已经使用 firebase 部署注释将网页项目托管到 Filebase 控制台,现在如何下载项目文件?
firebase deploy
Run Code Online (Sandbox Code Playgroud) firebase firebase-authentication firebase-realtime-database google-cloud-functions google-cloud-firestore
我有由 Firestore 事件触发的云功能。出于安全原因,我需要每天多次手动启用/禁用此功能。所以每次我都必须通过云功能控制台编辑和打开和关闭其Firestore触发事件。
有没有更简单的方法来“暂停”云功能?
我想分别从所有这些服务中检查属于 Google Cloud 的服务的状态:服务运行状况 GCP。我是 GCP 的新手,想知道如何使用云功能等进行检查。有人能给我任何建议吗?
是否可以检索以前版本的 Google Cloud Function?
我知道这个问题之前已经被问过,但答案不起作用。我尝试过寻找bucket包含我的旧版本的版本,但我似乎找不到它。
google-cloud-storage firebase google-cloud-platform google-cloud-functions
我尝试替换:
const stripe =const stripe=require("stripe")('sk_test_51KMbN...');
Run Code Online (Sandbox Code Playgroud)
到
const stripe = require("stripe")(functions.config().stripe.secret);
Run Code Online (Sandbox Code Playgroud)
但是当我运行 firebase 模拟器时,我遇到了一个错误:
错误:无法从源加载函数定义:无法从函数源生成清单:TypeError:无法读取未定义的属性(读取“秘密”)
我已经将其设置如下:
firebase functions:config:set stripe.secret=< SECRET KEY>
Run Code Online (Sandbox Code Playgroud)
我可以通过运行看到它:
firebase functions:config:get
Run Code Online (Sandbox Code Playgroud)
我在functions/index.js中的代码是
const functions = require("firebase-functions");
const express=require("express");
const cors=require("cors");
require('dotenv').config({ path: './.env' });
//API
const stripe = require("stripe")(functions.config().stripe.secret);
//App config
const app=express();
var admin = require("firebase-admin");
var serviceAccount = require("./serviceAccountKey.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
//middlewares
app.use(cors({origin: true}));
app.use(express.json());
async function createCheckoutSession(req, res) {
const domainUrl = process.env.WEB_APP_URL;
const { line_items, customer_email } = req.body;
if (!line_items || …Run Code Online (Sandbox Code Playgroud) node.js stripe-payments firebase reactjs google-cloud-functions
我的javascript云函数项目在部署时不断提示错误,状态代码为51。昨天之前也出现过同样的错误,只有重新运行几次部署脚本才能成功,但从昨天早上开始就再也没有成功过。我没有做任何修改我的项目。
以下都是启动和部署的脚本,start如果我运行yarn start或 ,则始终可以正确运行npm run start。
"start": "rm -rf dist && prettier -w src && npm run build && cp env.yaml clearmylist-46738ea42bf9.json package.json dist/ && cd dist && npx @google-cloud/functions-framework --target=clearMyList",
"deploy": "rm -rf dist && prettier -w src && npm run build && cp env.yaml clearmylist-46738ea42bf9.json package.json dist/ && gcloud functions deploy clear-my-list-google-cloud-functions --gen2 --runtime=nodejs18 --region=us-central1 --source=dist --entry-point=clearMyList --trigger-http --env-vars-file env.yaml --allow-unauthenticated --project clearmylist && rm -rf dist"
Run Code Online (Sandbox Code Playgroud)
以下是最新的运行错误日志yarn deploy,有人有解决此问题的经验或给我一些线索吗?任何帮助将不胜感激!
{ …Run Code Online (Sandbox Code Playgroud) 正如您从标题中可以理解的那样,我在使用 Firebase Functions Python 时遇到了问题。
我遇到以下错误。
Error: Failed to find the location of Firebase Functions SDK. Did you forget to run 'source /home/burak/projectFinale/functions/venv/bin/activate && python3.11 -m pip install -r requirements.txt'?
Run Code Online (Sandbox Code Playgroud)
而且,当我想做的时候firebase init functions,在它成为依赖项之前都可以。
发生以下错误:
? Do you want to install dependencies now? Yes
/bin/sh: 1: source: not found
/bin/sh: 1: source: not found
Run Code Online (Sandbox Code Playgroud)
我已经提出了上述建议,但错误仍然出现。
如果你能帮忙我会很高兴。提前致谢。
[必填] 环境信息
\n**平台:Windows wsl (Ubuntu)
\n我已按照以下步骤进行操作
\nhttps://firebase.google.com/docs/functions/get-started?gen=2nd&hl=ko#about_this_tutorial
\n但它发生了
\n“无法从源加载函数定义:FirebaseError:用户代码加载失败。无法确定后端规范”
\n当我运行“firebase emulators:start”命令时
\n[错误报告]
\n当我运行“firebase emulators:start”时
\n`i emulators: Starting emulators: functions, firestore\nRun Code Online (Sandbox Code Playgroud)\n\xe2\x9a\xa0 函数:以下模拟器未运行,从函数模拟器调用这些服务将影响生产:auth、数据库、托管、pubsub、存储
\ni firestore:Firestore 模拟器记录到 firestore-debug.log
\n\xe2\x9c\x94 firestore:Firestore 模拟器 UI websocket 正在 9150 上运行。
\ni ui:模拟器 UI 记录到 ui-debug.log
\ni 函数:正在观看“/mnt/c/Users/sunwu/Downloads/Tryagain/pythontry/functions”以获取云函数...
\n\xe2\x9c\x94 功能:使用主机上的node@18。
\n\xe2\xac\xa2 函数:无法从源加载函数定义:FirebaseError:用户代码加载失败。无法确定\n后端规范
\n …python node.js firebase google-cloud-functions google-cloud-firestore
我正在尝试在 Firebase 功能上制作一个应用程序(Puppeteer 应用程序),并且我在文件中有以下内容.json。它在本地运行良好。
"custom": {
"following_training": false,
"worked": false
}
Run Code Online (Sandbox Code Playgroud)
但是,当我远程推送它并尝试设置我的代码firebase functions:config:set app="$(cat .env-production.json)"(本质上避免输入长.json配置环境变量字符串)时,我确实收到以下警告:
HTTP Error: 400, Invalid value at 'variable.text' (TYPE_STRING), false
所以是的,它基本上告诉我只发送这种json:
"custom": {
"following_training": "false",
"worked": "false"
}
Run Code Online (Sandbox Code Playgroud)
然后,如果我添加那个to-bool 包来实际检查代码内部,它就会远程工作,如果toBool(local_vars.app.custom.worked) == false......
没有更干净的方法吗...?在 firebase config-env 文档中,实际上没有关于布尔字段的示例。
我在输入时确实得到了预期的内容firebase functions:config:get,但也很奇怪的是,我在 Google Cloud Platform 功能的仪表板中没有任何变量(我得到刷新的代码、Puppeteer 的选项设置等......)。
不确定是否有任何关系。
环境变量可能仅由 Firebase 使用,不需要发送到 GCP。
编辑:工作得很好,不是Firebase问题。