英文:
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.
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.
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论