I have two cloud functions doing some simple book keeping work.
handleUserIn keeps a trace of a user logging in and handleUserOut keeps a trace of a user logging out.
Below is the code for the two functions:
exports.handleUserIn = onRequest(
{cors: ["*"]},
(request, response) => {
const usrIDParam = JSON.stringify(request.params);
const userId = JSON.parse(usrIDParam)[0];
handleUserTrace(userId, "Log-In");
response.send(0);
}); /* End of handleUserIn */
export const handleUserOut = onRequest({cors: ["*"]}, (request, response) => {
response.set("Access-Control-Allow-Origin", "*");
response.set("Access-Control-Allow-Methods", "GET, POST");
const usrIDParam = JSON.stringify(request.params);
const userId = JSON.parse(usrIDParam)[0];
// corsHandler(request, response, async () => {
handleUserTrace(userId, "Log-Out");
response.send(0);
// }); // End corsHandler.
}); /* End of handleUserOut */
Now comes my question. Though the two functions both do their jobs as expected, when I test them; I get some annoying messages in the developer console of my web browser.
Like the one below:
GET
https://handleuserout-vzu8tf4c5q-uc.a.run.app/xyxCIPDXZXgiR6DsjWx3yFOuXYZ4
[HTTP/2 500 365ms]
GET
https://handleuserout-vzu8tf4c5q-uc.a.run.app/xyxCIPDXZXgiR6DsjWx3yFOuXYZ4
Status
500
VersionHTTP/2
Transferred370 B (21 B size)
Referrer Policystrict-origin-when-cross-origin
Request PriorityHighest
DNS ResolutionSystem
I suspect I did something wrong concerning the CORS, but I am not confident about that.
Does any one have an idea of where the issue is, and how I can fix it ?