从 nodejs 调用 firebase 云函数 [英] Calling a firebase cloud function from nodejs

查看:38
本文介绍了从 nodejs 调用 firebase 云函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从另一个 nodejs 服务器或只是一个 nodejs 脚本调用来自 firebase 的云函数.

I want to call a cloud function from firebase from another nodejs server or just a nodejs script.

我的 firebase 函数是一个 onCall 函数.

My firebase function is an onCall function.

我正在使用 https://www.npmjs.com/package/firebase-admin 用于与 firebase 交互,但它似乎没有调用云函数的方法......

I am using https://www.npmjs.com/package/firebase-admin for interacting with firebase but it doesn't seem to have a way of calling cloud functions...

我可以用其他方式吗?像一个http请求?

Can I do it any other way? Like a http request?

推荐答案

简而言之:你必须触发http事件.
目前,firebase 确实支持两个调用选项.

如果您通读文档这里这里,总会有一些触发器.
Firebase 接受 http 请求.
即使您使用示例 1 中的移动应用程序,在后台,firebase SDK 也会发出 http 请求.

另一个选项是 scheduled 调用,但正如我从评论中得到的那样,它不是你在找什么.

In short: You have to trigger http event.
Currently, firebase does support two invoke options.

If you read through documentation here and here, there is always has to be some trigger.
And firebase accept http request.
Even if you use mobile app from example one, under the hood, firebase SDK will make http request.

The other option is scheduled invocations, but as I get from comments, it's not what you're looking for.

这篇关于从 nodejs 调用 firebase 云函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆