So, I managed to call a Google Cloud Function v1 function using httpsCallable on the web app (in both dev/local, and prod) and then the corresponding onCall usage in my cloud function definition -- I don't get any CORS complaints and the function call works.
However, now that I'm upgrading to cloud functions v2 I am getting blocked by CORS
I am getting this error in dev, when running the React web app locally trying to call a deployed v2 cloud function:
Access to a fetch at 'https://<function URL>' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
The client code is as follows:
Solved! Go to Solution.
Well, wouldn't you know...I changed things around like you suggested and that didn't work, then when I changed it back it worked -- but i'd stupidly used a lowercase 'f' in the client code and uppercase 'F' in the server function def. I will give you the prize of accepting this as a solution, not because it was the solution, but maybe people like me can check spelling/case better in the future before posting 🙂