GCP开启计费时出现计费错误

huangapple go评论80阅读模式
英文:

GCP Billing error when Billing is enabled

问题

I have this Python code:

def upload_to_gcs(bucket_name, local_file_path, gcs_file_name):
    """
    Uploads local files to Google Cloud Storage (GCS).

    :param bucket_name: string
    :param local_file_path: string
    :param gcs_file_name: string
    :return: None
    """
    client = storage.Client()
    bucket = client.bucket(bucket_name)
    blob = bucket.blob(gcs_file_name)
    blob.upload_from_filename(local_file_path)

which is failing with this error:

Exception has occurred: Forbidden
403 POST https://storage.googleapis.com/upload/storage/v1/b/monzo/o?uploadType=multipart: {
  "error": {
    "code": 403,
    "message": "The billing account for the owning project is disabled in state closed",
    "errors": [
      {
        "message": "The billing account for the owning project is disabled in state closed",
        "domain": "global",
        "reason": "accountDisabled",
        "locationType": "header",
        "location": "Authorization"
      }
    ]
  }
}

I have confirmed and Billing is definitely enabled, see below.

GCP开启计费时出现计费错误
GCP开启计费时出现计费错误

I also went through all possible solutions in this similar question. Nothing worked, double checked the bucket exists and all that. Finally also tried reaching Google but got stuck in chatbot which didn't help.

EDIT: Tried checking in Cloud Shell and got this back

miguel@cloudshell:~$ gcloud beta billing projects describe miguel-377315
billingAccountName: billingAccounts/0193C3-8A2BD3-44C7DB
billingEnabled: true
name: projects/miguel-377315/billingInfo
projectId: miguel-377315

Does anyone have an idea?

英文:

I have this Python code:

def upload_to_gcs(bucket_name, local_file_path, gcs_file_name):
    """
    Uploads local files to Google Cloud Storage (GCS).

    :param bucket_name: string
    :param local_file_path: string
    :param gcs_file_name: string
    :return: None
    """
    client = storage.Client()
    bucket = client.bucket(bucket_name)
    blob = bucket.blob(gcs_file_name)
    blob.upload_from_filename(local_file_path)

which is failing with this error:

Exception has occurred: Forbidden
403 POST https://storage.googleapis.com/upload/storage/v1/b/monzo/o?uploadType=multipart: {
  "error": {
    "code": 403,
    "message": "The billing account for the owning project is disabled in state closed",
    "errors": [
      {
        "message": "The billing account for the owning project is disabled in state closed",
        "domain": "global",
        "reason": "accountDisabled",
        "locationType": "header",
        "location": "Authorization"
      }
    ]
  }
}

I have confirmed and Billing is definitely enabled, see below.

GCP开启计费时出现计费错误
GCP开启计费时出现计费错误

I also went through all possible solutions in this similar question. Nothing worked, double checked the bucket exists and all that. Finally also tried reaching Google but got stuck in chatbot which didn't help.

EDIT: Tried checking in Cloud Shell and got this back

miguel@cloudshell:~$ gcloud beta billing projects describe miguel-377315
billingAccountName: billingAccounts/0193C3-8A2BD3-44C7DB
billingEnabled: true
name: projects/miguel-377315/billingInfo
projectId: miguel-377315

Does anyone have an idea?

答案1

得分: 3

这是一个导致存储桶名称不正确的错误。与计费无关。当我修复了存储桶名称后,一切都正常工作。

英文:

It was a bug which was causing the bucket name to be incorrect. Nothing to do with billing. When I fixed the bucket name, everything worked.

huangapple
  • 本文由 发表于 2023年3月4日 07:10:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/75632596.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定