server code
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.hello = functions.https.onCall((data, context) => {
console.log(data.text);
return 123;
});
client code
const myFunc = firebase.functions().httpsCallable('hello');
myFunc({text: 'world'}).then((rslt)=>{
console.log('rslt:', rslt);
});
But it is not work. I got error message at client browser console.
Access to fetch at 'https:// ==skip== /hello' from origin 'http://localhost:5000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
How can I solve this problem? I did not find a solution in the google guide documentation.
I see comments and add content.
The query does not arrive at the server.
If I try after functions deploy it works fine.
But it doesn't show up on the local console, but on the firebase console.
How can I make a local server call?
It's crazy to deploy every time you test a function.