ThouCheese / cloud-storage-rs

A crate for uploading files to Google cloud storage, and for generating download urls.
MIT License
123 stars 88 forks source link

SSL error in google cloud run #118

Closed razum90 closed 2 years ago

razum90 commented 2 years ago

Hey, thanks for doing this library.

I am setting the SERVICE_ACCOUNT_JSON env variable with the json key I downloaded from a service account I created in google cloud. It works when I try it locally. However when try it towards the application when it's deployed in google cloud I get the following error:

Reqwest(reqwest::Error { kind: Request, url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"www.googleapis.com\")), port: None, path: \"/oauth2/v4/token\", query: None, fragment: None }, source: hyper::Error(Connect, Ssl(Error { code: ErrorCode(1), cause: Some(Ssl(ErrorStack([Error { code: 337047686, library: \"SSL routines\", function: \"tls_process_server_certificate\", reason: \"certificate verify failed\", file: \"../ssl/statem/statem_clnt.c\", line: 1914 }]))) }, X509VerifyResult { code: 20, error: \"unable to get local issuer certificate\" })) })\n

I am executing this code in my application:

CLI.object()
        .create(
            &bucket,
            buf.to_vec(),
            &Uuid::new_v4().to_string(),
            &*content_type,
        )
        .await

Using: cloud-storage = "0.11.1"

Locally my service is just running with http, and in cloud https. Also, the service account being used is not the same that runs my service. But I am not sure why it's failing. Any idea?

Thanks.

razum90 commented 2 years ago

It was not related to this lib, I needed to install ca-certificates on my debian docker image that was running the service: RUN apt-get -y install ca-certificates.