So this is incredibly frustrating. I'm trying to create a simple Google Cloud Function to process an incoming webhook. It needs to be publicly accessible. Ok so I created it, then some folks were saying that allUsers
needs to be granted the Cloud Functions Invoker role - tried that, still get 403. I then saw the message on the console that for v2 functions, I need the "Cloud Run Invoker" role instead (see screenshot).
However, I don't see any way to add this role. The roles available to this function are extremely limited - there's not even a Cloud Run section, much less an Invoker role anywhere (I used the filter as well).
I also tried creating a new custom role by just copying the "Cloud Run Invoker" role as well - same result.
How do I just make this function publicly accessible?
For adding Cloud run invoker
role follow the below steps:
Open the cloud run console.
Click the checkbox of the service and you can find permissions on the top of the service as shown in the image below.
Enter the principal email you can find in the IAM page.
Then you can find the role Cloud Run Invoker
from the drop down as shown in the below image.
You can find this information in the official document also where you can add using command also.
From this official document for second gen cloud function we need to allow unauthenticated invocation.