Search code examples
google-cloud-platformgcloudgoogle-cloud-run

Google Cloud Run: "FAILED_PRECONDITION: due to quota restrictions" but real quota not reached yet


I am encountering an issue while deploying my NodeJS server using Google Cloud CLI and would appreciate some guidance. Here is the process I followed:

  1. Executed npm run build for my project, which completed successfully.
  2. Set up Google Cloud service account and authenticated it.
  3. Configured Docker with Google Cloud using gcloud auth configure-docker.
  4. Set the Google Cloud project ID and the region for Cloud Run.
  5. Tried deploying my service to Cloud Run using gcloud run deploy.

However, the deployment fails with the following error:

ERROR: (gcloud.run.deploy) FAILED_PRECONDITION: failed precondition: due to quota restrictions, cannot run builds in this region. Please contact support

Here are some details about my setup:

  • NodeJS version: 18.12.0
  • Google Cloud CLI version: latest 457.0.0
  • Region: europe-west3

I suspect the issue might be related to quota restrictions in the europe-west3 region, but I'm unsure how to confirm or resolve this. I have checked my account quota restrictions and it's okay, haven't reached it yet. Has anyone else faced a similar issue, or does anyone know how to work around?


Solution

  • Update (25/01/24)

    A few users have upgraded to v460.0.0, and confirmed that this issue is now fixed.

    Problem

    On the Google Cloud CLI version 456.0.0 it was added the following:

    Network Security

    • Add --billing-project required flag to gcloud network-security firewall-endpoints create command to provide Google Cloud project ID for API enablement check, quota, and endpoint uptime billing.
    • Add --update-billing-project flag to gcloud network-security firewall-endpoints update command to update the Google Cloud project used for API enablement check, quota, and endpoint uptime billing. So it might be related.

    And the --billing-account command seems like a beta feature:

    (BETA) This command sets or updates the billing account associated with a project.

    --billing-project=BILLING_PROJECTThe Google Cloud project that will be charged quota for operations performed in gcloud. If you need to operate on one project, but need quota against a different project, you can use this flag to specify the billing project. If both billing/quota_project and --billing-project are specified, --billing-project takes precedence. Run $ gcloud config set --help to see more information about billing/quota_project.

    So I would recommend to set this value to your correct billing project, but even so, it feels like something is wrong from their side.

    For more info: https://cloud.google.com/sdk/gcloud/reference/beta/billing/projects/link

    Solution

    I simply downgraded to 455.0.0 again and it deployed without a problem.

    How to downgrade?

    If you're deploying via GitHub actions:

     - name: Cloud run deploy
        uses: "google-github-actions/deploy-cloudrun@v2"
        with:
          ...
          gcloud_version: "455.0.0"
    

    With gcloud CLI:

    gcloud components update --version=445.0.0
    

    With Gitlab deploy (.gitlab-ci.yml):

    image: google/cloud-sdk:455.0.0