https://opendal.apache.org/ logo
Enable GCS to use AK/SK authentication
# general
j
Hi I am integrating OpenDAL into our project and I found that the parameters for GCS are different from AWS and Aliyun OSS. It cannot be authenticated using AK/SK (Access Key/Secret Key), but instead requires credentials. How should I configure the parameters to enable GCS to use AK/SK authentication?
x
Hi, GCS's native JSON API requries it's own credential file now. It's not supported to use AK/SK auth for gcs yet.
OpenDAL has it's native support to read
GOOGLE_APPLICATION_CREDENTIALS
so if your app is running on GCP, you don't need to configure the credential by hand.
The credential is a json file, and looks like the following:

https://cdn.discordapp.com/attachments/1141566498645741628/1141567962478809208/image.png▾

j
Do you consider supporting AK/SK authentication? Previously, I was able to connect to GCS service using the AWS CPP SDK. Now I am switching to OpenDAL, but I cannot connect to GCP using AK/SK authentication anymore. 😅
x
If you prefer to use GCS's XML API (which is similiar to S3), you can use s3 service directly.
OpenDAL connect all services in their native API, for gcs, it means we will use GCS JSON API.
j
I have tried to connect with S3 backend, but encountered an error: unspecific protocol error detected. 🤣
x
Would you like to share the code on connection s3 backend?
My code is in this PR.
x
Thanks, would you like to share the op_options passed for gcs?
There is a hint that gcs'x xml endpoint should be: https://storage.googleapis.com
j

https://cdn.discordapp.com/attachments/1141566498645741628/1141631734077734963/image.png▾

which means the endpoint is https://storage.googleapis.com
x
Ok, I have the following questions: - What's the option that passed to opendal? Based on my knowledge, opendal doesn't support useSSL and port option. - "unspecific protocol error" seems not an error returned by OpenDAL, can you share the full error message?
This PR seems not build an opendal blocking operator yet.
j
the full log is here

https://cdn.discordapp.com/attachments/1141566498645741628/1141635921100419163/image.png▾

It can be determined that the blocking operator was used during compilation, as both s3 and minio have been tested successfully.
x
We handled this in gcs service but not for s3.
To fix this in a quick way, you can enable opendal's
native-tls
feature so we can use
openssl
instead of
rustls
.
j
Hi, I recompiled opendal with native-tls, but now it's giving a 403 error. Using aws-sdk-cpp in the same way returns a 200 response. I suspect there might be an issue with the signer but have no clue🤔
this is the log

https://cdn.discordapp.com/attachments/1141566498645741628/1142023216093745183/image.png▾

this is the log with aws-sdk-cpp

https://cdn.discordapp.com/attachments/1141566498645741628/1142023568973111296/image.png▾

x
Typically, if there is an issue with our signer, the service will return a 401 error. On the other hand, a 403 error usually indicates that our request has been signed correctly but lacks sufficient permissions. For instance, this could occur when attempting to access a non-existent file without having the necessary "list objects" permission. I noticed that we are trying to access different files here. Could you please try accessing the same file using the "head" method? Alternatively, you can attempt to write or read from the same file.
j
Thank you for the reply, I can confirm that the file exists and can be successfully read using aws-sdk-cpp 🤔
x
Thanks for the input. I will try to reproduce this issue.
Hi, I setup a gcs bucket and test with s3 keys, and I only found some tests with special keys
xxx !@#$%^&()_+-=;',.txt
failed. Path like
files/insert_log/111111111111111111/111111111111111111/111111111111111111/0/111111111111111111.txt
works.
Can you help running opendal's behavior test against with gcs for debugging? To setup opendal's behavior test, add
.env
under opendal's project root with content:
Copy code
OPENDAL_S3_TEST=on
OPENDAL_S3_BUCKET=<bucket>
OPENDAL_S3_ENDPOINT=https://storage.googleapis.com
OPENDAL_S3_ACCESS_KEY_ID=ak
OPENDAL_S3_SECRET_ACCESS_KEY=sk
OPENDAL_S3_REGION=us-east-1
and running
RUST_LOG=debug cargo test s3 --features=native-tls
During our test, we found gcs's behaivor is different from s3, I have created an issue for that: https://github.com/apache/incubator-opendal/issues/2891
j
Thank you, I will test it again.🫡
x
Thanks for the help!
j
Hi @Xuanwo ,Last week, I was testing other scenarios and didn't continue testing GCS with AK/SK. Just now, I wrote another simple demo and found that the same error is still occurring.

https://cdn.discordapp.com/attachments/1141566498645741628/1145618089447260260/image.png▾

the file is here 🤣

https://cdn.discordapp.com/attachments/1141566498645741628/1145618277435965440/image.png▾

x
Hi, this error is still hyper's http2 issue. Can you try enabling
native-tls
feature for OpenDAL? Since there is not plan for hyper to fix this from upstream, we will fix it later in OpenDAL.
Hi @jiaoew, this PR has been merged, please give it another try.
j
there are still the same problems. Which information should I provide to help solve this problem? 😭
x
strange, I can't reproduce this error locally. Are you building opendal with our latest commit?
j
I want to use some code that hasn't been merged yet. Currently, I am using this branch.https://github.com/jiaoew1991/opendal/tree/blocking-layer
x
seems gcs redirect you to logic pages.

https://cdn.discordapp.com/attachments/1141566498645741628/1145636163575619604/image.png▾

Maybe the endpoint here is wrong?
the correct endpoint to gcs should be https://storage.googleapis.com
Hi, @jiaoew, I removed your previous image since it contains some sensitive information.
j
after change to storage.googleapis.com, the error became "SignatureDoesNotMatch" 😄

https://cdn.discordapp.com/attachments/1141566498645741628/1145637331966107708/image.png▾

x
Oh...
I got it.
Please remove the
:443
from your endpoint.
j
wow, It works now 👍
thank you for your help 😄
x
I created an issue for this: https://github.com/Xuanwo/reqsign/issues/365 Since it's not urgent for now, we will fix it later (maybe after opendal v0.40)
🥰 , welcome to contribe back your improvement of opendal c bindings!
j
I and @yah2er0ne will find a way to merge the recent changes into the main branch, removing the obstacles for using opendal in Milvus. 🥹
x
Issues are welcome if some help we can provide from opendal side!
4 Views