Repository navigation
Closed
Labels
Description
Describe the bug
GCS not work, and Operator::check returns an IncompleteMessage error.
Steps to Reproduce
pub fn create_operator(bucket: impl AsRef<str>) -> Result<Operator> {
let builder = services::Gcs::default().bucket(bucket.as_ref());
Ok(Operator::new(builder)?.finish())
}
#[tokio::test]
async fn basic_probe() -> Result<()> {
let op = create_operator("xxx-datasets").unwrap();
dbg!(op.check().await);
Ok(())
}Just block for 10 seconds or so,
[test/probe.rs:18:5] op.check().await = Err(
Error {
kind: Unexpected,
message: "loading credential to sign http request",
status: Temporary,
operation: "list",
context: [
(
"called",
"reqsign::LoadCredential",
),
(
"service",
"gcs",
),
(
"path",
"/",
),
(
"listed",
"0",
),
],
source: Some(
reqwest::Error {
kind: Request,
source: hyper_util::client::legacy::Error(
SendRequest,
hyper::Error(
IncompleteMessage,
),
),
},
),
},
)Expected Behavior
The operator of GCS can work correctly.
Additional Context
Add trace_subscriber and got:
running 1 test
2025-06-12T05:56:50.245403Z DEBUG ThreadId(02) opendal::services::gcs::backend: 241: backend build started: GcsBuilder { config: GcsConfig { root: None, bucket: "xvu-datasets", endpoint: None, scope: None, .. }, .. }
2025-06-12T05:56:50.245487Z DEBUG ThreadId(02) opendal::services::gcs::backend: 244: backend use root /
2025-06-12T05:56:50.245499Z DEBUG ThreadId(02) opendal::services::gcs::backend: 263: backend use endpoint: https://storage.googleapis.com
2025-06-12T05:56:50.264007Z DEBUG ThreadId(02) reqwest::connect: 788: starting new connection: http://metadata.google.internal/
2025-06-12T05:56:52.004969Z DEBUG ThreadId(02) reqwest::connect: 788: starting new connection: http://metadata.google.internal/
2025-06-12T05:56:55.422559Z DEBUG ThreadId(02) reqwest::connect: 788: starting new connection: http://metadata.google.internal/
2025-06-12T05:57:00.092319Z DEBUG ThreadId(02) reqwest::connect: 788: starting new connection: http://metadata.google.internal/
[test/probe.rs:18:5] op.check().await = Err(
Error {
kind: Unexpected,
message: "loading credential to sign http request",
status: Temporary,
...
It looks like failing to connect a strange address http://metadata.google.internal/
Are you willing to submit a PR to fix this bug?
- Yes, I would like to submit a PR.
Reacted by dosubot, Wang Guan, dentiny, jjkoh95 and Tran Ngoc Tuan
Activity
dosubot commentedon Jun 12, 2025
Hi @kingwingfly! I'm Dosu and I’m helping the opendal team.
The repeated attempts to connect to http://metadata.google.internal/ are due to OpenDAL's GCS backend trying to load credentials from the Google Cloud metadata server by default. This is expected if you haven't provided credentials explicitly and are not running on GCP. The resulting IncompleteMessage error is a symptom of failing to connect to that endpoint and not receiving a valid response, which blocks credential loading and thus all GCS operations.
To fix this, provide valid GCS credentials using either the credential string, credential file path, or token methods in your GcsBuilder. If you do not want OpenDAL to attempt loading credentials from the metadata server, call .disable_vm_metadata() on your builder. For example:
This will prevent OpenDAL from trying to reach the metadata server and should resolve the error if your credentials are valid. See the relevant builder methods and config options for more details on credential loading and disabling metadata server access
reference
reference.
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
kingwingfly commentedon Jun 12, 2025
After disable_vm_matadata, I got with
credencial_pathset to"/home/me/.config/gcloud/application_default_credentials.json"However,
gcloud storage objects list gs://xxx-datasets/works. I'll keep trying and if I succeed, I'll close this issue.Xuanwo commentedon Jun 12, 2025
One possible issue is that opendal may not support the credential type specified in your local JSON file. What is the value of the
typefield in yourapplication_default_credentials.json?We support the following type:
service_accountexternal_accountimpersonated_service_accountkingwingfly commentedon Jun 12, 2025
The type field is
authorized_user(◐‿◑)Xuanwo commentedon Jun 12, 2025
Interesting. Let me take a look on this type.
kingwingfly commentedon Jun 12, 2025
It's produced by
gcloud init; gcloud auth application-default login;[-]bug: service GCS failed to work[/-][+]feat: opendal should support gcs `authorized_user` credential[/+]jokester commentedon Jun 20, 2025
More on this key type: https://cloud.google.com/docs/authentication/application-default-credentials#personal
CredentialFile::AuthorizedUserin https://github.com/Xuanwo/reqsign/blob/main/services/google/src/credential.rs seems to be a match. But the tree, maybereqsign:0.17.0, is quite different fromreqsign:0.16.3used by recent Opendal. I couldn't simply use it in[replace]to test 😕dentiny commentedon Jul 9, 2025
+1 for authorized user credential support, it's prob the easiest setup to play with GCS for personal users. :(
venim commentedon Nov 21, 2025
bumping this for posterity. updating opendal to use
reqsign:0.17.0is not trivial, but it will unblock the default path (and most secure) path for humans who want to use opendal to interact with GCS.buu-nguyen commentedon Dec 17, 2025
Bumping this
Xuanwo commentedon Dec 17, 2025
Already supported in https://github.com/apache/opendal-reqsign/blob/main/services/google/src/provide_credential/authorized_user.rs. It will be ready once gce has been migrated to reqsign 2.0
See #6553 for more details.
venim commentedon Dec 17, 2025
I will keep an eye on that issue tracker for progress. Is there any sort of estimated timeline for when the GCS backend will be migrated to reqsign 2.0 (not trying to rush, just trying to plan)?
Xuanwo commentedon Nov 20, 2026
Thanks for reporting this and sharing how the credential was generated. The GCS backend now supports
authorized_usercredentials fromgcloud auth application-default loginthroughreqsign-google, which GCS adopted in #7229. It exchanges the refresh token for an OAuth access token.On native builds, the default credential chain checks the standard Application Default Credentials (ADC) file location. You can also pass the JSON file explicitly with
credential_path. Seecore/services/gcs/src/backend.rs.AI-generated triage comment.