设置Heroku导轨GOOGLE_APPLICATION_CREDENTIALS(firebase)错误

时间:2018-07-15 14:36:20

标签: ruby-on-rails firebase heroku firebase-authentication

我有一个将Firebase Firestore用于数据库应用程序的Rails应用程序。在我运行以下命令之后:

export GOOGLE_APPLICATION_CREDENTIALS =“ / home / user / Downloads / [FILE_NAME] .json”

要设置本地使用的凭据,该应用程序可以在本地正常运行。尝试在heroku服务器上进行部署时出现问题。当我运行heroku run rails console时,出现此错误:

/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仪表板,在config vars上,将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

0 个答案:

没有答案