google-cloud-platformgoogle-cloud-functionsgoogle-cloud-iam

Google Cloud Function - Can't Find Cloud Function Run role


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). Console Message

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). Missing "Cloud Run" section

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?


Solution

  • For adding Cloud run invoker role follow the below steps:

    1. Open the cloud run console.

    2. Click the checkbox of the service and you can find permissions on the top of the service as shown in the image below.

    image

    1. Enter the principal email you can find in the IAM page.

    2. Then you can find the role Cloud Run Invoker from the drop down as shown in the below image. 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.