ruby-on-rails - 设置 Heroku rails GOOGLE_APPLICATION_CREDENTIALS (firebase) 错误
问题描述
我有一个使用 firebase firestore 作为数据库应用程序的 rails 应用程序。在我运行这些命令后:
导出 GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/[FILE_NAME].json"
要设置本地使用的凭据,该应用程序在本地运行良好。当我尝试在 heroku 服务器上部署时出现问题。当我运行 heroku run rails 控制台时,出现此错误:
/app/vendor/bundle/ruby/2.3.0/gems/googleauth-0.6.2/lib/googleauth/application_default.rb:61:in `get_application_default': Could not load the default credentials. Browse to (RuntimeError)
https://developers.google.com/accounts/docs/application-default-credentials
for more information
然后我转到heroku仪表板,在配置变量上,首先将var GOOGLE_APPLICATION_CREDENTIALS设置为空值,然后在终端中运行:
heroku config:add GOOGLE_APPLICATION_CREDENTIALS="$(cat file/path/to/credential-file.json)"
运行 heroku run rails 控制台后仍然出现错误:
/app/vendor/bundle/ruby/2.3.0/gems/googleauth-0.6.2/lib/googleauth/credentials_loader.rb:83:in `rescue in from_env': Unable to read the credential file specified by GOOGLE_APPLICATION_CREDENTIALS: file { (RuntimeError) } does not exist
有什么帮助吗?我指的是这些指令:
https://cloud.google.com/docs/authentication/production
解决方案
推荐阅读
- html - 如何在页面中设置多种背景颜色?
- firebase - 使用 Firebase 可调用函数时如何检索用户的身份验证数据?
- javascript - 将 CSS 不透明度应用于父级,但不应用于子级
- java - Kafka POM 依赖问题 - ClassNotFoundException: org.apache.kafka.test.TestCondition
- android - 单个 .html 文件上的 Android WebView 给出“net::ERR_CACHE_MISS”
- ansible - Jinja2 列表中的项目更改为大写
- netlogo - 如何从 x 轴上直线上存在的海龟中获取随机选择的海龟的“仅 x 坐标”?
- php - 分享到 Facebook 时我的 url 数据丢失
- html - Flexbox justify-content: space-around; 不工作..?
- c# - 从 GMap.NET.GMapControl 获取不可见的图像