Zyyeric opened a new issue, #4992:
URL: https://github.com/apache/opendal/issues/4992

   ### Describe the bug
   
   When attempting to use the GCS storage service, opendal fails to load the 
application default credential from ADC Well-known places 
(https://cloud.google.com/docs/authentication/application-default-credentials). 
I did realize that this is implemented within the 
load_via_well_known_location() in reqsign/src/google/credential.rs. However, 
while having the ADC stored within 
[HOME/.config/gcloud/application_default_credentials.json], I ended up getting 
this error. 
   
   ```
   Unexpected (temporary) at stat, context: { called: reqsign::LoadCredential, 
service: gcs, path: file.txt } => loading credential to sign http request, 
source: error sending request for url 
(http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token?scopes=https://www.googleapis.com/auth/devstorage.read_write)
   ```
   
   ### Steps to Reproduce
   
   Obtain ADC through gcloud CLI 
   
   ```
   gcloud auth application-default login 
   ```
   
   which shall output 
   
   ```
   Your browser has been opened to visit:
   
   https://accounts.google.com/o/oauth2/auth?...
   
   Credentials saved to file: 
   [HOME/.config/gcloud/application_default_credentials.json]
   
   These credentials will be used by any library that requests Application 
Default Credentials (ADC).
   ...
   ```
   
   Then, create a basic opendal operator, and send a head request. 
   ````
       let mut builder = opendal::services::Gcs::default();
       builder
           .bucket("my-bucket-here");
   
       let op = Operator::new(builder)?
           .layer(LoggingLayer::default())
           .finish();
   
       // Check if the file exists by querying its metadata
       match op.stat("my-path-here).await {
           Ok(metadata) => {
               // If successful, print the metadata or a success message
               println!("File exists! Metadata: {:?}", metadata);
           }
           Err(e) => {
               // If there is an error, print it
               eprintln!("Error accessing file: {}", e);
           }
       }
   ````
   
   ### Expected Behavior
   
   Opendal shall load the credential and returns the metadata of the file 
stored in GCS
   
   ### Additional Context
   
   _No response_
   
   ### Are you willing to submit a PR to fix this bug?
   
   - [ ] Yes, I would like to submit a PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to