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

问题描述 投票:0回答:1

我有这个 Python 代码:

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)

因此错误而失败:

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"
      }
    ]
  }
}

我已经确认并且确实启用了计费,请参见下文。

我还在this similar question中查看了所有可能的解决方案。什么都没用,仔细检查了桶是否存在等等。最后也尝试联系谷歌,但被困在聊天机器人中,但无济于事。

编辑:尝试检查 Cloud Shell 并取回它

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

有人有想法吗?

python google-cloud-platform google-cloud-billing
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.