标签: google-cloud-functions

如何取消部署Firebase的云功能?

我正在试验Firebase的Cloud Functions,并在functions-samples repo中部署了一个样本,并使用它将其链接到现有项目firebase use --add.

由于我刚刚玩游戏,这些文件没有添加到我的版本控制中,我无法再访问已完成的计算机.我想建立这个功能或创建新功能,但我不确定如何1)修改和重新部署原始功能或2)取消use --add并开始新鲜.我在我的firebase控制台中看到了这个功能,但是没有"删除"或"删除"按钮,并且已经通过CLI文档阅读了寻找无效的线索.

感谢您为firebase的堆栈添加功能.任何指导都非常感谢.

firebase google-cloud-functions

38
推荐指数
4
解决办法
2万
查看次数

如何在Cloud Functions for Firebase中获取服务器时间戳?

我知道你可以在web,ios和android中提取服务器时间戳 - 但是新的Cloud Functions for Firebase呢?我无法弄清楚如何获得服务器时间戳?用例是我想在收到电子邮件时为其添加时间戳.

在Web上,它是Firebase.database.ServerValue.TIMESTAMP

但这似乎在功能节点服务器接口中不可用?

我觉得已经很晚了,我可能会忽略这一点......

编辑

我正在这样初始化

admin.initializeApp(functions.config().firebase);
const fb = admin.database()
Run Code Online (Sandbox Code Playgroud)

然后,就像这样被调用..

Firebase.database.ServerValue.TIMESTAMP
Run Code Online (Sandbox Code Playgroud)

但是,这是来自客户端集成.在功能上,Firebase未像这样初始化.我试过了

admin.database().ServerValue.TIMESTAMP
Run Code Online (Sandbox Code Playgroud)

fb.ServerValue.TIMESTAMP
Run Code Online (Sandbox Code Playgroud)

node.js firebase firebase-realtime-database google-cloud-functions firebase-admin

38
推荐指数
6
解决办法
2万
查看次数

firebase云错误无法从源加载函数定义

无法将更改部署到 firebase cloud

操作:cmd 中的“Firebase 部署”

结果:

i  deploying functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
+  functions: required API cloudfunctions.googleapis.com is enabled
+  functions: required API cloudbuild.googleapis.com is enabled
i  functions: preparing codebase default for deployment
Run Code Online (Sandbox Code Playgroud)

错误:无法从源加载函数定义:无法从​​函数源生成清单:错误 [ERR_PACKAGE_PATH_NOT_EXPORTED]:C:\Users\rushikesh.chaskar\IdeaProjects\todosmanager\node_modules\firebase\package.json 中没有定义“导出”main

node.js firebase google-cloud-functions

38
推荐指数
5
解决办法
7万
查看次数

通过Google Cloud Platform从Firebase发送自动电子邮件(无第三方)

我们已经做了几个小时的研究了.

到处出现的第一个解决方案(其他StackExchange问​​题)也在使用第三方服务SendGrid.com,有时与Zapier一起使用,但这不是我们希望实现的方法.

对于没有中间第三方的发送,第一个似乎可行的解决方案是"Firebase触发器",它在Google I/O 2014上宣布但从未复活,似乎已合并到仍在Alpha中的Google Cloud Functions.

我很确定我差不多一年前在FireBase博客的一个链接中看到了这个解决方案,但似乎唯一存在的帖子现在已经空了.

我们之前从未使用过GCP,但是我们的逻辑告诉我们这个问题应该在Google内部使用另一个GCP现有API来解决,而Mail API显然是正确的,但似乎没有任何方式我们的Firebase Web App可以提出请求.

任何人(最好有GCP经验)请解释一下这里的情况,以及Google如何期望FireBase开发人员向他们的客户发送电子邮件?

email google-app-engine firebase google-cloud-platform google-cloud-functions

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

在本地运行云功能会出现错误"functions.config()不可用"

Firebase的Cloud Functions刚刚发布,我正在按照全新安装的说明进行操作.这是"开始使用"页面.

我已经安装了"npm install -g firebase-tools",我的所有文件都在我的项目中.我正在使用WebStorm 2016.3和Node.JS v6.10.0.

我安装了firebase登录和firebase init函数并进行了设置.我的设置. 这是我的设置.

我的package.json

 {
   "name": "functions",
   "description": "Cloud Functions for Firebase",
    "dependencies": {
     "firebase-admin": "^4.1.2",
     "firebase-functions": "^0.5"
   },
    "private": true
 }
Run Code Online (Sandbox Code Playgroud)

前两行代码工作正常.

  const functions = require('firebase-functions');
  const admin = require('firebase-admin');
Run Code Online (Sandbox Code Playgroud)

但是当我尝试运行这条线时......

  admin.initializeApp(functions.config().firebase);
Run Code Online (Sandbox Code Playgroud)

我收到这个错误.

 Error: functions.config() is not available. Please use the latest version of the Firebase CLI to deploy this function.
   at init (/Users/.../functions/node_modules/firebase-functions/lib/config.js:46:19)
   at Object.config (/Users/.../functions/node_modules/firebase-functions/lib/config.js:29:9)
   at Object.<anonymous> (/Users/.../functions/index.js:11:31)
   at Module._compile (module.js:570:32)
   at Object.Module._extensions..js (module.js:579:10)
   at Module.load (module.js:487:32)
   at tryModuleLoad …
Run Code Online (Sandbox Code Playgroud)

node.js firebase google-cloud-functions

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

将自定义域用于Google Cloud功能

在使用HTTP触发器时,我无法在任何地方看到为我的Google云功能设置自定义域的任何选项.似乎是一个相当重大的遗漏.有没有办法使用自定义域而不是他们的location-project.cloudfunctions.net域或某些解决方法达到相同的效果?

我读了一篇文章,建议在函数前面使用CDN,并将功能URL指定为拉区.这可行,但会带来不必要的成本 - 在我的场景中,没有任何内容能够被缓存,因此使用CDN远非理想.

google-cloud-platform google-cloud-functions

35
推荐指数
4
解决办法
9957
查看次数

适用于Firebase异步的云功能等待样式

看起来Cloud Functions不支持Async-Await表示法.有没有办法我可以使用Babel直到他们做或建议使用promises?

我在Node上的当前函数是这样的:

exports.getToken = async (req, res) => {
  //1. Generate token from Braintree
  const result = await gateway.clientToken.generate();

  //2. Return the client token
  res.json(result.clientToken);
};
Run Code Online (Sandbox Code Playgroud)

firebase google-cloud-functions

34
推荐指数
3
解决办法
2万
查看次数

通过身份验证保护Google Cloud功能http触发器

我正在按照本指南尝试Google云端功能:https://cloud.google.com/functions/docs/quickstart

我创建了一个带有HTTP触发器的函数,并且能够执行POST请求以触发函数写入数据存储区.

我想知道是否有办法保护这个HTTP端点?目前似乎它将接受来自任何地方/任何人的请求.

当谷歌搜索时,我看到大多数结果都谈到使用Firebase保护内容.但是,我没有在这里使用Firebase服务.

我的选择是让它打开,希望没有人知道URL端点(默默无闻的安全性),或者在函数本身中实现我自己的auth检查?

security authentication google-cloud-datastore google-cloud-functions

34
推荐指数
2
解决办法
7954
查看次数

使用 Python 的 Firebase 云函数?

我们正在将 GCP 的 Firebase 与 Firestore 一起用于我们正在开发的新移动应用程序。作为这项工作的一部分,我们需要部署许多云功能,这些功能将作为 Firestore 触发器进行一些后端处理。

我们的目的是使用 firebase cli 工具将部署封装在 Firebase 内部。但是,当我们尝试使用“firebase init 函数”调用为函数启动 Firebase 项目时,只有两种语言选项是“Javascript”和“Typescript”,并且唯一可部署的堆栈似乎是 Node.js。

在之前的 GCP 项目中,我们已经部署了基于 Python 的云函数(使用 gcloud cli),理想情况下,我们希望继续将 Python 用于我们的 Firebase 云函数。所以我的问题是:

  1. 是否可以部署基于 Python 的 Firebase 云函数?如果不:

  2. 我们可以简单地回到使用 gcloud cli 部署基于 Python 的 GCP 云函数,并且仍然让它们作为 Firestore 触发器工作吗?

谢谢

python firebase google-cloud-platform google-cloud-functions google-cloud-firestore

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

如何将cloud firestore中的数据导入本地模拟器?

我希望能够在本地运行云函数并针对生产数据的副本进行调试。有没有办法将在线的数据复制到本地firestore模拟器?

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

34
推荐指数
6
解决办法
2万
查看次数