I'm working inside Google Cloud, completely inside single project. My current issue is associated with corrected access rights only.
I've developed a simple website hosted on Cloud Storage and having a public access with a link like https://<name_of_bucket>.storage.googleapis.com/ This site has a js script which makes an API call (POST/GET/OPTIONS) to Cloud Function (Gen 2, Python 10) which sends the response back to js. CORS enabled. Everything works fine when I set public permissions:
I'm trying to get rid of "allUsers" and let invoke the Gen2 function only by the website hosted in Google Storage Bucket.
Could you please suggest a right combination of access rights to enable the mentioned access without public access to Cloud Function? Thank you
All my attempts leads to 403 response once I substitute "allUsers" with any of the following (for both Cloud Functions Invoker / Cloud Run Invoker): 0. project level Service Accounts like @<project_name>.iam.gserviceaccount.com
TL;DR: You can't call a private backend from Cloud Storage serving
Why? Because Cloud Storage is only a file server: it serve static website files. That's all.
Then, the file are interpreted and ran on your browser. Whatever the thing you do, it's YOUR browser that perform the action, NEVER Cloud Storage.
By the way, you can't say "Cloud Storage reach Cloud Run/Functions", it's wrong.
However, you have solutions: