Google Cloud 403 错误 所属项目的结算帐号在状态不存在时处于停用状态



我去了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

我还与谷歌云客户支持确认,计费是应该启用的。关于如何修复此错误的任何建议?

我在使用 CLI 上传文件时遇到了问题,我试图复制到实际上不存在的存储桶中。它抛出了同样的错误"访问拒绝异常:403 拥有项目的计费帐户在状态关闭时被禁用"。

如果计费一切正常,也许您指向的存储桶不存在?

只是想标记似乎有非计费原因可以抛出这样的错误。.

最近刚刚启用 API 时,可能会发生"拥有项目的计费帐户在状态不存在时被禁用"错误消息。所以建议再试一次。

就我而言,

"AccessDeniedException: 403 The billing account for the owning project is disabled in state closed"

因为我没有将"计费帐户"添加到我创建的项目中。 您可以在"计费项目"选项卡中将项目链接到"计费帐户"。 完成此操作后,请等待一段时间,错误应该消失。

就我而言,我发送了错误的网址"gs://undefined/undefined",并且出现错误"拥有项目的计费帐户在关闭状态下被禁用"。正确的网址解决了我的问题。

最新更新