PermissionDenied:尝试运行异步Google Cloud Speech异步转录时出现403错误

时间:2018-08-10 17:08:32

标签: google-cloud-storage google-cloud-speech

当我尝试对托管在Google云上的.flac文件运行异步转录请求时遇到以下错误。

$ python3 transcribe_async.py gs://[file].flac
Traceback (most recent call last):
  File "[]/anaconda3/lib/python3.6/site-packages/google/api_core/grpc_helpers.py", line 54, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "[]/anaconda3/lib/python3.6/site-packages/grpc/_channel.py", line 514, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "[]/anaconda3/lib/python3.6/site-packages/grpc/_channel.py", line 448, in _end_unary_response_blocking
    raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
    status = StatusCode.PERMISSION_DENIED
    details = "The caller does not have permission"
    debug_error_string = "{"created":"@1533912393.258761000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1095,"grpc_message":"The caller does not have permission","grpc_status":7}"
>

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

Traceback (most recent call last):
  File "transcribe_async.py", line 105, in <module>
    transcribe_gcs(args.path)
  File "transcribe_async.py", line 83, in transcribe_gcs
    operation = client.long_running_recognize(config, audio)
  File "[]/anaconda3/lib/python3.6/site-packages/google/cloud/speech_v1/gapic/speech_client.py", line 284, in long_running_recognize
    request, retry=retry, timeout=timeout, metadata=metadata)
  File "[]/anaconda3/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py", line 139, in __call__
    return wrapped_func(*args, **kwargs)
  File "[]/anaconda3/lib/python3.6/site-packages/google/api_core/retry.py", line 260, in retry_wrapped_func
    on_error=on_error,
  File "[]/anaconda3/lib/python3.6/site-packages/google/api_core/retry.py", line 177, in retry_target
    return target()
  File "[]/anaconda3/lib/python3.6/site-packages/google/api_core/timeout.py", line 206, in func_with_timeout
    return func(*args, **kwargs)
  File "[]/anaconda3/lib/python3.6/site-packages/google/api_core/grpc_helpers.py", line 56, 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 caller does not have permission

我已在.zshrc文件中添加了指向服务帐户json的导出语句,并通过浏览器将自己,服务帐户电子邮件以及项目所有者和编辑者添加为云存储桶的所有者,并且我运行了gcloud auth activate-service-account --key-file="[].json",但没有任何帮助。我忘记了什么?任何帮助,不胜感激。

1 个答案:

答案 0 :(得分:1)

您需要将文件制作为publicly readable。将权限设置为allUsers后,您将可以在请求中使用文件。