标签: google-cloud-functions

Google Cloud Functions支持CORS?

我刚刚完成了Hello World Google Cloud Functions教程并收到了以下响应标头:

Connection ? keep-alive
Content-Length ? 14
Content-Type ? text/plain; charset=utf-8
Date ? Mon, 29 Feb 2016 07:02:37 GMT
Execution-Id ? XbT-WC9lXKL-0
Server ? nginx
Run Code Online (Sandbox Code Playgroud)

如何添加CORS标头以便能够从我的网站调用我的功能?

cors google-cloud-platform google-cloud-functions

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

从另一个云功能调用云功能

我正在使用云功能在免费火花层上调用另一个云功能.

是否有一种特殊的方式来调用另一个云功能?或者您只是使用标准的http请求?

我试过直接调用其他函数:

exports.purchaseTicket = functions.https.onRequest((req, res) => {    
  fetch('https://us-central1-functions-****.cloudfunctions.net/validate')
    .then(response => response.json())
    .then(json => res.status(201).json(json))
})
Run Code Online (Sandbox Code Playgroud)

但是我得到了错误

FetchError:请求 https:// us-central1-functions-****.cloudfunctions.net/validate failed,reason:getaddrinfo ENOTFOUND us-central1-functions - *****.cloudfunctions.net us-central1-functions -*****cloudfunctions.net:443

哪个听起来像firebase阻止连接,尽管它是谷歌拥有的,因此它不应该被锁定

Spark计划仅允许对Google拥有的服务的出站网络请求.

如何使用云功能调用另一个云功能?

javascript node.js firebase google-cloud-platform google-cloud-functions

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

功能被杀死.错误:超出配额

我在Spark Plan上使用Firebase的云功能.

我使用cronJob每2分钟调用一次函数.

我最近得到了这个错误:

功能被杀死.错误:超出配额

尝试部署时,我收到类似的错误:

部署错误:功能加载错误:错误:超出配额

我知道火花计划有一个配额,但我的统计数据如下:

118处决

207总调用

火花计划表示你获得125,000 /月免费调用是否有执行限制?我尝试部署一个新功能,但我得到相同的错误.

我超过了什么配额?

firebase google-cloud-functions

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

firebase部署到自定义区域(eu-central1)

有没有办法指定将部署我的firebase功能的区域/区域.

实际上我没有在文档中找到任何关于它的内容,我的功能总是部署到我们 - central1但我希望在eu-central1上有...

是否可以在Firebase - Config - File中设置它?

{
  "database": {
    "rules": "database.rules.json"
  },
  "hosting": {
    "public": "public",
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

我也看了一下cli选项,但我没有找到任何东西.

Firebase项目本身已正确设置为欧洲区域oO

提前致谢

firebase google-cloud-functions

27
推荐指数
4
解决办法
8235
查看次数

Firebase错误的云功能:"400,不允许更改功能触发类型或事件提供程序"

当我运行时,firebase deploy我收到此错误消息:

functions: HTTP Error: 400, Change of function trigger type or event provider is not allowed
Run Code Online (Sandbox Code Playgroud)

在我的控制器下,firebase deploy我收集firebase deploy,然后在用户登录时将其更新到数据库位置.此代码工作正常:

functions: HTTP Error: 400, Change of function trigger type or event provider is not allowed
Run Code Online (Sandbox Code Playgroud)

这是我的云功能.它旨在在用户登录时触发,这会更新Firebase数据库中的位置.然后,该函数向IBM Watson发送HTTP请求以获取令牌,然后将令牌写入文件.该功能从Node正常运行.触发器似乎是问题所在.

functions: HTTP Error: 400, Change of function trigger type or event provider is not allowed
Run Code Online (Sandbox Code Playgroud)

node.js firebase google-cloud-functions

27
推荐指数
2
解决办法
4894
查看次数

比较AWS-lambda,Azure功能和Google Cloud功能

我想通过选择aws-lambda,azure函数或google云函数来开发无服务器项目,然后我想比较每个项目以便为我的项目选择更好的项目.

我需要为我的项目需求选择最稳定的无服务器技术.这些技术比较有什么材料吗?这些无服务器技术是否有任何受支持的框架?

azure aws-lambda google-cloud-functions azure-functions

26
推荐指数
2
解决办法
6819
查看次数

如何在Cloud Functions for Cloudbase中发出HTTP请求?

我正在尝试使用Cloud Functions for Firebase拨打苹果收据验证服务器.知道如何进行HTTP调用吗?

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

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

Firebase云功能:onRequest和onCall之间的区别

通过文档,我遇到了:

...您可以直接使用HTTP请求或来自客户端调用来调用函数.

来源

那里(引用中的链接)是一个提及functions.https.onCall.

但是在这里的教程中,使用了另一个函数functions.https.onRequest,我应该使用哪个函数?为什么?它们之间有什么区别/相似之处?

文档functions.https在这里.

firebase google-cloud-functions

26
推荐指数
2
解决办法
7869
查看次数

Firebase功能:不清楚"连接错误"

我使用HTTP Firebase Cloud功能每次运行都会出现此错误:

Function execution took ****ms, finished with status: 'connection error'

它发生的不一致,但我不能完全解决问题所在.我不相信错误在我的应用程序中,因为它没有显示错误打印输出.在运行此云功能时,我自己与firebase的连接并没有消失.

任何想法为什么Firebase随着"连接错误"随机失败云功能执行?

firebase google-cloud-functions

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

使用函数和Firestore时,FieldValue未定义

我有以下功能:

const functions = require('firebase-functions');
const admin = require('firebase-admin');
const FieldValue = require('firebase-admin').FieldValue;

module.exports = functions.firestore
  .document('students/{studentId}')
  .onDelete(event => {
    const student = event.data.previous.data();
    const { id, semester } = student;
    const classId = student.class;
    const deleteObj = {};
    deleteObj[id] = FieldValue.delete(); //Line 12, this is where the error orccurs
    return admin
      .firestore()
      .collection('semesters')
      .doc(semester)
      .collection('students')
      .doc(classId)
      .update(deleteObj);
  });
Run Code Online (Sandbox Code Playgroud)

每次运行它我都会收到以下错误:

TypeError: Cannot read property 'delete' of undefined
    at module.exports.functions.firestore.document.onDelete.event (/user_code/deleteStudent.js:12:37)
Run Code Online (Sandbox Code Playgroud)

看着文档我真的不知道我做错了什么?

// Get the `FieldValue` object
var FieldValue …
Run Code Online (Sandbox Code Playgroud)

javascript firebase google-cloud-functions google-cloud-firestore

25
推荐指数
3
解决办法
3306
查看次数