Deploying Heroku app with a google-credential.json

Viewed 121

I have an app that uses Google cloud vision API. I tried the following ways:

  1. Create a .profile that contains echo ${GOOGLE_CREDENTIALS} > /app/google-credentials.json. And set GOOGLE_APPLICATION_CREDENTIALS=/app/google-credentials.json, GOOGLE_CREDENTIALS=. I tried to commit the .profile file but was not able to locate it anywhere in the dyno file system. My question with this method is, if I want to create a file in the ephemeral file system, how do I do it? Is putting it in the root of my IntelliJ project, git add and git push the right way?

  2. Manually run the heroku bash, and echo a json file with the credentials. Even though when I $ls the directory I saw the file, the app reports

    "Error reading credential file from environment variable GOOGLE_APPLICATION_CREDENTIALS, value '$HOME/google-credentials.json': File does not exist."

  3. Push the json directly in the git (I know it is not secure, but I was so desperate). This did not work either.

0 Answers
Related