i've installed google/cloud/translate in my project, the version in the Gemfile.lock is:
google-cloud-translate (2.1.0) With the below code:
require "google/cloud/translate" project_id = "<Project ID>" # from my Google Cloud Platform translate = Google::Cloud::Translate.new version: :v2, project_id: project_id That is what the documentation says and also what this answer related suggest (please note that i'm using v2 instead of v3)
RuntimeError: Could not load the default credentials. Browse to https://developers.google.com/accounts/docs/application-default-credentials for more information This part returns true:
require "google/cloud/translate" Update I already followed all the steps in:
https://cloud.google.com/docs/authentication/production
Created a service account, a credential key and set the env variable (on Windows), then I tried testing the credential configuration with the google/cloud/storage example and it's worked fine, but when I tried with: google/cloud/translate gem with
translate = Google::Cloud::Translate.new version: :v2, project_id: project_id
I still got the same error
What can be the error? Thanks in advance for any help.
export GOOGLE_APPLICATION_CREDENTIALS. There are even Ruby code examples on that page to show how to do it. What am I missing here?