in my project I use some cloud functions: one of them sets custom claims, it works properly, I have a second function that when fired should write some data on the realtime Db,but once is fired I get a CORS Error; this is the faulty function:
exports.insertUser = functions.https.onCall((data)=>{
const db = admin.database();
const reference = "userProfile";
return db.ref(reference).push(data.user).then(()=>{
return {message: "utente inserito"};
}).catch((error)=>{
return error;
})
});
this is the error that I get:
Access to fetch at 'https://us-central1-trasportostudenti-
bc19c.cloudfunctions.net/insertUser' from origin 'http://localhost:8100' has been blocked by CORS policy: Response to preflight request doesn't pass access control check
firebase's log states that the problem is in my code; any suggestions to fix this error?