GOOGLE_APPLICATION_CREDENTIALS must be defined.How to set enviroment variable at Java Spring on Heroku?

核能气质少年 提交于 2021-01-07 02:48:40

问题


I am using Firebase and Google Cloud Vision api and Cloud Storage with Java Spring. I create the value of GOOGLE_APPLICATION_CREDENTIALS via eclipse on my own computer. I am using heroku for host. But I could not find how to set this enviroment variable on the server I hosted.

Here is the error

Message":"An error has occurred.","ExceptionMessage":"The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

I tried passing credentials using code https://cloud.google.com/docs/authentication/production

But it is not working for me. Because The functions I use do not have a setCredentials function. I think I should save this as an environment variable in the Heroku but I couldn't.

来源:https://stackoverflow.com/questions/65485072/google-application-credentials-must-be-defined-how-to-set-enviroment-variable-at

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!