I am locally testing a Firebase Cloud Function. When I call this function using the local URL http://localhost:5001/projectName/us-central1/functionName as described here:
exports.createSession = functions.https.onRequest((_req, res) => {
res.status(200).send('TESTING');
});
the function works and it returns the string.
However, when I call this function:
exports.createSession = functions.https.onCall((data, context) => {
return 'TESTING';
});
It throws the error: {"error":{"message":"Bad Request","status":"INVALID_ARGUMENT"}}
I'd like to use the latter function because I want to access the context.auth object to check for user Firebase authentication.
I'm using Firebase CLI v8.4 and Node v10.20.
What am I missing from the second function to get it working? I am not calling it with any arguments as I do not need to.