2

I'm encountering this issue whenever I try to deploy a new Javascript function or an existing one on Google Cloud Functions using the gcloud-cli.

Here's the command I'm running to deploy my function

gcloud functions deploy [cloud_funtion_name]
--gen2 --region=us-central1
--runtime=nodejs18
--entry-point=[function_entry_point]
--trigger-http
--allow-unauthenticated
--max-instances=83

After about 10 minutes being endlessly stuck on the Cloud run service step, I get this error

Preparing function...done.                                                                                                                                     
X Deploying function...                                                                                                                                        
  ✓ [Build] Logs are available at [logs_link]                                                                                                                                                        
  ✓ [Service]                                                                                                                                                  
  . [ArtifactRegistry]                                                                                                                                         
  . [Healthcheck]                                                                                                                                              
  . [Triggercheck]                                                                                                                                             
Failed.                                                                                                                                                        
ERROR: (gcloud.functions.deploy) OperationError: code=13, 
message=Could not create or update Cloud Run service [cloud_funtion_name].
Reconciling latest revision template. Resource readiness deadline exceeded.

And this happens even if I delete and redeploy. I checked several threads on StackOverFlow and Google Issue Tracker, but none seems to really help...

Anyone got a clue ? If further informations are needed, I'll gladly handle them.

Until Yesterday afternoon, I was able to deploy my functions without any form of issue. But overnight, the same yesterday, my deploys started to fail, even the updates won't work anymore.

I'm actually clueless.

Milo40
  • 21
  • 6
  • Most likely your function failed to startup. Look for details in the logs (click the logs tab in the web GUI). – John Hanley Apr 23 '23 at 21:47
  • Well... Checked the logs and apparently it's an issue with **Cloud Run**. I don't know what's being wrong since the logs are pretty poor. It reads : `Unable to create 0 instances for [cloud_function_revision] because there are already 0 in this region` Can't find much about that issue, even on the support and community. – Milo40 Apr 25 '23 at 14:16
  • That error has been mentioned several times in the past few weeks on Stack Overflow. I am not aware of the cause or solution. Add details about the error to your post. – John Hanley Apr 25 '23 at 18:02
  • Actually the deployment works fine on other regions; At first at least because at some point, I encounter the same issue with other regions. Some region let you do up to 5 revisions, others only 2... It varies but eventually start failing at some point. So I'm still clueless. Never seen that before. – Milo40 Apr 26 '23 at 23:26
  • `Could not create or update Cloud Run service Could not get Cloud Run service. Deadline Exceeded.` That's what I got. Identical code like 2 months ago. Any ideas? – BartusZak May 02 '23 at 15:56
  • 1
    @BartusZak, Still nothing. But as workaround, I had to deploy to different regions. But it's really hacky. – Milo40 May 04 '23 at 10:33

1 Answers1

1

I think under the hood GCP may be creating a serveless VPC on the first deploy, in subsequent revision this can get messed up.

I made a new serverless VPC connector using the CLI and can now use it in my functions without having to switch regions a zillion times.

gcloud compute networks vpc-access connectors create [CONNECTOR_NAME] \
  --network [VPC_NETWORK_NAME] \
  --region [REGION] \
  --range [IP_RANGE]
starball
  • 20,030
  • 7
  • 43
  • 238