Firebase onCall function headers and parameters

Viewed 25

Can someone tell me how I should start with a Firebase onCall function? according to the documentation there is a protocol of headers and parameters that I have to include, where should I include them?. I am working from my localhost with Emulators.

I try something as simple as this:

export const getFileInformation2 = functions.https.onCall( (data, context) => {
  return { msg: 'Hello from Firebase!' };
});

Then I run:

firebase emulators:start --only functions

So it generates the following url:

http://localhost:5001/[myProjectName]/us-central1/getFileInformation2

but it throws error:

{"error":{"message":"Bad Request","status":"INVALID_ARGUMENT"}}
1 Answers

onCall is meant for when you are using the client SDKs for firebase Docs. If you are calling a url using curl or any non-sdk client use the onRequest Docs

If you want to use on call, a good example on using the client sdk can be found here

Related