问题
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