Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing callable cloud functions with the Firebase CLI shell

Tags:

People also ask

How do I call Firebase callable function?

The Cloud Functions for Firebase client SDKs let you call functions directly from a Firebase app. To call a function from your app in this way, write and deploy an HTTPS Callable function in Cloud Functions, and then add client logic to call the function from your app.


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

Request has incorrect Content-Type.

and

RESPONSE RECEIVED FROM FUNCTION: 400, {"error":{"status":"INVALID_ARGUMENT","message":"Bad Request"}}

Here is ho w I am trying to call this function on shell

myFunc.post(dataObject)

I have also tried this

myFunc.post().form(dataObject)

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

Update:

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"
 }
}

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