【发布时间】:2021-06-04 05:03:52
【问题描述】:
我编写了一个 Ruby 脚本,它将音频文件上传到 Google 云存储。
def upload_to_Google_cloud(audio_file)
project_id = "<project_id>"
key_file = "<json_file>"
storage = Google::Cloud::Storage.new project: project_id, keyfile: key_file
bucket_name = storage.buckets.first.name
puts bucket_name
bucket = storage.bucket bucket_name
local_file_path = "/path/#{audio_file}"
file = bucket.create_file local_file_path, "#{audio_file}.flac"
return "Uploaded #{file.name}"
end
不过,每次我运行命令 -> ruby video_dictation.rb 时,它都会返回一个错误,即 xxxxxxxxx 没有 storage.buckets.list 访问 Google Cloud 项目的权限。 (Google::Cloud::PermissionDeniedError).
任何帮助,建议?谢谢!
【问题讨论】:
-
当前凭证的作用是什么?您有当前凭证的电子邮件吗?您能否提供有关基础身份的更多详细信息?
标签: ruby-on-rails ruby google-cloud-platform google-speech-to-text-api