I’m trying to set up GOOGLE_APPLICATION_CREDENTIALS but keep getting this error
java.io.IOException: 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 credential
I have defined in my application properties:
spring.cloud.gcp.project-id=PROJECT_ID spring.cloud.gcp.credentials.location=lasspath:/src/main/resources/key.json
Added the dependency in the pom file:
<dependency> <groupId>com.google.cloud</groupId> <artifactId>google-cloud-dialogflow</artifactId> <version>1.0.0</version> </dependency>
Tried to do it from the terminal(windows) as well no luck:
> set GOOGLE_APPLICATION_CREDENTIALS="C:UsersuserDesktop**********srcmainresourceskey.json"
Advertisement
Answer
Solved by running in the terminal:
$env:GOOGLE_APPLICATION_CREDENTIALS="C:UsersuserDesktop*********srcmainresources*****.json"
In addition to setting the relevant role in IAM section of GCP since I’ve encountered a PERMISSION_DENIED Error after