Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Gcloud deploy function returns: Could not create or update Cloud Run service

Since 3 days, When deploying new cloud functions or revisions, I'm getting errors. It happened suddenly.

I tried at first updating a deployed Javascript cloud function using gcloud (as I usually do) and ran into the following errors :  

Milo40_0-1682369118683.png

or often that one :

Milo40_1-1682369140770.png

This happens whenever I try to update or deploy a function. Even after I change the location. I'm really clueless as the log infos are not very informative. Here's the command I use for deploying :

gcloud functions deploy <function_name> --gen2 --region=us-central1 --runtime=nodejs18 --entry-point=<entry_method> --trigger-http --allow-unauthenticated --max-instances=83

Checking my quotas shows that I've not even yet consumed more than 1% of it for us-central1.
I really need some help here, running short on the deadline... Please.

1 4 3,739
4 REPLIES 4

Hello @Milo40,

Welcome to Google Cloud Community!

This issue occurs when Cloud Run's service agent does not exist or it doesn't have the (roles/run.serviceAgent) role.

To verify this, please check https://cloud.google.com/run/docs/troubleshooting#service-agent.

Thanks

Hello @Michael_Conde 

Thanks for your warm welcome, Thanks for stopping by.

Well... I'm not sure to be pointing at the right service but I did check his permissions and it did have the Cloud Run Service Agent role.

 

Milo40_0-1682551209587.png

 

Hi Milo,

Were you able to resolve this issue? I am facing the same issue while trying to deploy my function - failing on the cloud run service step.

Hello @TylerHSL 

Unfortunately no, I wasn't able to for some reason.
I had to use a little trickery which consisted on scattering my deployments between different regions. Some on us-[x] and others to europe.

I think this issue might have something to do with quotas on some regions... But can't tell for sure.