簡體   English   中英

Google Cloud 403 錯誤擁有項目的計費帳戶在狀態不存在時被禁用

[英]Google Cloud 403 Error The billing account for the owning project is disabled in state absent

我繼續使用 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 上傳文件時遇到問題,我試圖將文件復制到實際不存在的存儲桶中。 它引發了同樣的錯誤“AccessDeniedException:403 擁有項目的計費帳戶在關閉狀態下被禁用”。

如果計費一切順利,也許您指向的存儲桶不存在?

只是想指出似乎有非計費原因可能會引發此類錯誤..

最近剛剛啟用 API 時可能會出現“在 state 缺席中禁用了所屬項目的計費帳戶”錯誤消息。 所以建議再試一次。

就我而言,

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

發生了,因為我沒有將“計費帳戶”添加到我創建的項目中。 您可以將您的項目鏈接到計費項目選項卡中的計費帳戶。 一旦你這樣做了,等待一段時間,錯誤應該消失了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM