I have a javascript web application written in React which is using the Firebase SDK to make calls to my Firebase Cloud Functions written in Node 8. For simplicity, the code looks like this:
API index.js
module.exports.test = functions.https.onCall((data, context) => {
return 'Finished'
})
React code
app.functions().httpsCallable('test')().then(console.log)
The code itself works great, however when looking at the logs, I can see 2 invocations.
This seems to be from the CORS preflight request the browser is making before making the actual call.
Am I charged for this preflight request invocation, and how can I prevent it (if at all)? Are there any headers or settings I can add either client or function side to ensure that my function invocation quota is essentially halved?