谷歌云403错误:所属项目的计费帐户处于禁用状态缺失。

10

我登录了Google Cloud并启用了一个项目、结算和Cloud Speech to Text API。然后我下载了一个.json文件。接着我在PyCharm中尝试执行这段基础代码。

    import os
    os.environ['GOOGLE_APPLICATION_CREDENTIALS'] ="instant-medium-282.json"
    
    from google.cloud import speech_v1
    from google.cloud.speech_v1 import enums
    
    client = speech_v1.SpeechClient()
    
    encoding = enums.RecognitionConfig.AudioEncoding.FLAC
    sample_rate_hertz = 44100
    language_code = 'en-US'
    config = {'encoding': encoding, 'sample_rate_hertz': sample_rate_hertz, 'language_code': language_code}
    uri = 'gs://bucket_name/file_name.flac'
    audio = {'uri': uri}
    
    response = client.recognize(config, audio)

但我一直收到这个错误:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/grpc/_channel.py", line 826, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/grpc/_channel.py", line 729, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.PERMISSION_DENIED
    details = "The billing account for the owning project is disabled in state absent"
    debug_error_string = "{"created":"@1593884707.640503000","description":"Error received from peer ipv6:[2607:f8b0:4009:813::200a]:443","file":"src/core/lib/surface/call.cc","file_line":1055,"grpc_message":"The billing account for the owning project is disabled in state absent","grpc_status":7}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/sal.py", line 16, in <module>
    response = client.recognize(config, audio)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/google/cloud/speech_v1/gapic/speech_client.py", line 255, in recognize
    return self._inner_api_calls["recognize"](
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/google/api_core/gapic_v1/method.py", line 143, in __call__
    return wrapped_func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/google/api_core/retry.py", line 281, in retry_wrapped_func
    return retry_target(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/google/api_core/retry.py", line 184, in retry_target
    return target()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/google/api_core/timeout.py", line 214, in func_with_timeout
    return func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/google/api_core/grpc_helpers.py", line 59, in error_remapped_callable
    six.raise_from(exceptions.from_grpc_error(exc), exc)
  File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 The billing account for the owning project is disabled in state absent

我也向Google Cloud客户支持确认了计费已启用。有任何如何修复此错误的建议吗?


这个回答是否解决了你的问题?AccessDeniedException:403 要计费的项目与已关闭的结算账户相关联 - Martin Zeitler
5个回答

23

我在使用CLI上传文件时遇到了问题,我试图将文件复制到实际不存在的存储桶中。它抛出了同样的错误“AccessDeniedException:403 The billing account for the owning project is disabled in state closed”。

如果付款方面一切正常,也许您指向的存储桶不存在?

只是想提示一下,似乎会有非计费原因导致出现此错误。


如何指向默认存储桶 - Jose Javier Sanahuja
这对我也解决了问题 - 对我来说,错误是“拥有项目的计费帐户处于缺失状态”。确保存储桶存在解决了这个问题。 - Jeremy Hon

4
在我的情况下,
"AccessDeniedException: 403 The billing account for the owning project is disabled in state closed"

因为我创建的项目没有添加“计费账户”,所以出现了这种情况。 您可以在“计费项目”选项卡中将您的项目链接到一个计费账户。(链接) 完成后,请等待一段时间,错误应该就会消失。

3
当API刚刚启用时,“所属项目的计费帐户处于禁用状态”错误消息可能会出现。因此建议再试一次。

1
在我的情况下,我发送了错误的url 'gs://undefined/undefined',然后我得到了一个错误提示 "The billing account for the owning project is disabled in state closed"。正确的url解决了我的问题。

这绝对是一个 bug。很可能其他人也遇到了同样的问题。 - Lasharela

1
在我的情况下,由于资金不足,无法进行Google支付,这导致我的Google计费付款方式被取消配置。
请检查您的计费是否正常 https://console.cloud.google.com/billing

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接