SoftwareNetwork / sw

Software Manager. Build System, Build System Generator and Package Manager. C/C++ and other languages. Tools and libraries for Software Management.
https://software-network.org
Other
118 stars 24 forks source link

No ca certs file was found for GRPC #48

Closed hero106wen closed 4 years ago

hero106wen commented 4 years ago

An error throws out when I use sw on windows, Do I need to install a cert? How?

GrpcChannel Remote::getGrpcChannel() const { // keeping channel for too long causes issues // so we create a new one every time

static std::mutex m;
std::unique_lock lk(m);

static const grpc::SslCredentialsOptions ssl_options = []()
{
    grpc::SslCredentialsOptions ssl_options;
    path certsfn;
    // system's certs first?
    if (auto f = primitives::http::getCaCertificatesBundleFileName())
        certsfn = *f;
    else
    {
        certsfn = support::get_ca_certs_filename();
        if (!fs::exists(certsfn))
            throw SW_RUNTIME_ERROR("No ca certs file was found for GRPC.");
    }
    ssl_options.pem_root_certs = read_file(certsfn);
    return ssl_options;
}();

auto creds = grpc::SslCredentials(ssl_options);
auto channel = grpc::CreateChannel(api_url, secure ? creds : grpc::InsecureChannelCredentials());
return channel;

}

egorpugin commented 4 years ago

Hi,

  1. What is your sw --version output?
  2. Try to remove c:\Users\u\.sw\certs\ dir and try again.
egorpugin commented 4 years ago

Try sw --self-upgrade or dl new exe from the website and re-run again.