CLI外壳测试可调用的云功能

CLI外壳测试可调用的云功能

本文介绍了使用Firebase CLI外壳测试可调用的云功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试firebase functions:shell中的新的Firebase可调用云函数,但不断出现以下错误

I have been trying new firebase callable cloud functions in firebase functions:shell I keep on getting following error

这里是何w我想在shell上调用此函数

Here is how I am trying to call this function on shell

我也尝试过

但是然后我得到了错误的编码(窗体)错误. dataObject是有效的JSON.

But then I get wrong encoding(form) error. dataObject is valid JSON.

更新:

我认为我需要使用firebase serve来对这些callable https函数进行本地仿真.数据需要像这样在发布请求中传递(请注意其如何嵌套在data参数中)

I figured that I need to use firebase serve for local emulation of these callable https functions. Data needs to be passed in post request like this(notice how its nested in data parameter)

{
 "data":{
    "applicantId": "XycWNYxqGOhL94ocBl9eWQ6wxHn2",
    "openingId": "-L8kYvb_jza8bPNVENRN"
 }
}

我仍然无法确定的是,如何通过REST客户端调用该函数时传递虚拟身份验证信息

What I can't figure still is how do I pass dummy auth info while calling that function via a REST client

推荐答案

我设法在功能shell中运行它:

I managed to get it working running this from within the functions shell:

myFunc.post('').json({"message": "Hello!"})

这篇关于使用Firebase CLI外壳测试可调用的云功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 11:17