unable to connect to cloud sql

137 views
Skip to first unread message

jyoti ullagaddi

unread,
Jun 24, 2021, 7:00:31 AM6/24/21
to gce-discussion
Hi 

iam getting following error while connecting to cloud sql..
Caused by: 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 credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:134) ~[google-auth-library-oauth2-http-0.22.0.jar:na]
at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:119) ~[google-auth-library-oauth2-http-0.22.0.jar:na]
at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:91) ~[google-auth-library-oauth2-http-0.22.0.jar:na]
at com.google.cloud.sql.core.CoreSocketFactory$ApplicationDefaultCredentialFactory.create(CoreSocketFactory.java:341) ~[jdbc-socket-factory-core-1.2.0.jar:na]
... 57 common frames omitted

Antonio Gomes

unread,
Jun 25, 2021, 6:28:35 AM6/25/21
to gce-discussion

Hi,

As for how to assist with the issue itself, you may want to have a look on How the Application Default Credentials work documentation. As indicated, in case the environment variable GOOGLE_APPLICATION_CREDENTIALS is checked and specified, it should point to a file that defines the default credentials. Moreover this documentation provides a guide on how to get this credentials file.

Alternatively, you may solve your error by installing and logging into the Cloud SDK as indicated in the second point of this same section.

You can refer to Stackoverflow where is explained how to set the requested environment variable.
Reply all
Reply to author
Forward
0 new messages