You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
If I replace encoded-key with key.json location: key.json it works the same way incorrect.
The exception: Failed to instantiate [com.google.cloud.storage.Storage]: Factory method 'googleCloudStorage' 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.
The configuration class that is not able to instantiate credentials:
@fragaLY The custom googleCloudStorage method is expecting a generic CredentialsProvider that would be instantiated using the Core spring.cloud.gcp.credentials.encoded-key property. However, you are providing the Storage-specific spring.cloud.gcp.storage.credentials.encoded-key property that does not result in a DefaultCredentialsProvider bean being present in the application context.
You have two choices -- provide the generic spring.cloud.gcp.credentials.encoded-key property or provide a custom instance of DefaultCredentialsProvider that's based on the storage-specific property. See how the built-in autoconfiguration handles the creation of the storage object.
@elefeint Thanks for the response, switching to spring.cloud.gcp.credentials.encoded-key (not storage specific) really helped me while I was having the same problem.
If I'm not mistaken the configuration via spring.cloud.gcp.storage.credentials.encoded-key is explicitly mentioned here. Is it an error is the docs?
@BenjaminEckardt No -- the documentation is correct, as long as you rely on the autoconfigured Storage bean. With built-in autoconfiguration, spring.cloud.gcp.storage.credentials.encoded-key will take priority, if present. But the usecase in this issue is when you want to configure your own Storage bean. In this case, you'd have to read the property yourself and construct the credentials provider based on it.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello, seems like the issue is still there.
The example of my setup doesn't works correctly:
1st of all I've created a key for gcp storage and encoded it using (macOS):
base64 -i key.json -b -
After that I've passed the encoded key into profile:
Encoded key sample:
eAiLS0tLS1CRUdJT.....SQBSFIJ!N KF!LJA=
My application.yaml:
If I replace encoded-key with key.json
location: key.json
it works the same way incorrect.The exception:
Failed to instantiate [com.google.cloud.storage.Storage]: Factory method 'googleCloudStorage' 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.
The configuration class that is not able to instantiate credentials:
The part of service layer I use to read blobs:
The text was updated successfully, but these errors were encountered: