Open j143 opened 3 years ago
possibly related https://github.com/GoogleCloudPlatform/functions-framework-nodejs/issues/137
Docs: https://cloud.google.com/docs/authentication/production
static void authImplicit() {
// If you don't specify credentials when constructing the client, the client library will
// look for credentials via the environment variable GOOGLE_APPLICATION_CREDENTIALS.
Storage storage = StorageOptions.getDefaultInstance().getService();
System.out.println("Buckets:");
Page<Bucket> buckets = storage.list();
for (Bucket bucket : buckets.iterateAll()) {
System.out.println(bucket.toString());
}
}
the credentials may not be required:
The GOOGLE_APPLICATION_CREDENTIALS
are required.
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.gcp.autoconfigure.spanner.GcpSpannerAutoConfiguration$CoreSpannerAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gcp.autoconfigure.spanner.GcpSpannerAutoConfiguration$CoreSpannerAutoConfiguration]: Constructor threw exception; nested exception is 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.
o.s.c.g.a.c.GcpContextAutoConfiguration : The default project ID is chrome-flight-280312 2021-06-20 19:30:47.716 INFO 13548 --- [ restartedMain] c.g.c.s.core.DefaultCredentialsProvider : Default credentials provider for user 32555940559.apps.googleu sercontent.com 2021-06-20 19:30:47.717 INFO 13548 --- [ restartedMain] c.g.c.s.core.DefaultCredentialsProvider : Scopes in use by default credentials: [https://www.googleapis. com/auth/pubsub, https://www.googleapis.com/auth/spanner.admin, https://www.googleapis.com/auth/spanner.data, https://www.googleapis.com/auth/datastore, https://ww w.googleapis.com/auth/sqlservice.admin, https://www.googleapis.com/auth/devstorage.read_only, https://www.googleapis.com/auth/devstorage.read_write, https://www.go ogleapis.com/auth/cloudruntimeconfig, https://www.googleapis.com/auth/trace.append, https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth /cloud-vision, https://www.googleapis.com/auth/bigquery, https://www.googleapis.com/auth/monitoring.write] 2021-06-20 19:30:50.835 INFO 13548 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729