Home > database >  Windows gcp List objects fails - Curl error [77]
Windows gcp List objects fails - Curl error [77]

Time:06-01

Trying to list all object in a google storage bucket - this code runs fine in UNIX systems(centos 7/Mac), However when run from a windows server 2012/16 Vm I get Permanent error in ListObjects : EasyPerform() - CURL error [77]=Problem with the SSL CA cert (path? access rights?)[UNKNOWN]

void gcpFileDialog::getListOfObjectsInBucket()
{
    QString bucket = "exampleBucketName";///_gcpBucketLineEdit->text();
    if ((bucket.isNull()) || (bucket.isEmpty()))
    {
        QMessageBox::critical(this, tr("Error"), tr("GCP Bucket is invalid"));
        return;
    }

    namespace gcs = ::google::cloud::storage;

    // Create a client to communicate with Google Cloud Storage. This client
    // uses the default configuration for authentication and project id.
    google::cloud::StatusOr<gcs::ClientOptions> options = gcs::ClientOptions::CreateDefaultClientOptions();
    google::cloud::StatusOr<gcs::Client> client = gcs::Client::CreateDefaultClient();

    if (!client)
    {
        QMessageBox::critical(this, tr("Error"), tr("Failed to create Storage Client.\n\n%1").arg(QString::fromStdString(client.status().message())));
        return;
    }

    QStringList objectsInBucketList;
    for (auto&& object_metadata : client->ListObjects(bucket.toStdString()))
    {
        if (!object_metadata)
        {
            QMessageBox::critical(this, tr("Error"), tr("There was an Error listing the objects.\n\n%1").arg(QString::fromStdString(object_metadata.status().message())));
            client->ListObjects
            return;
        }

        objectsInBucketList.append(QString::fromStdString(object_metadata->name()));
    }

    if (objectsInBucketList.isEmpty())
    {
        QMessageBox::critical(this, tr("Error"), tr("No Objects found in bucket"));
        return;
    }

    for (QString& object : objectsInBucketList)
    {
        ///list of bucket object _gcpBucketObjectListTextEdit->append(object);
    }
}

I know next to nothing about curl / open ssl certificates (I don't believe this is related to the google managed ssl certificates either) I have used Choco to install openssl and curl on the host vm and added a lot of server roles and features.

The command works when called from Google Cloud SDK Shell - GSUTIL Any help tracking down the issue would be greatly appreciated.

CodePudding user response:

I think you need to install the certificate bundles as described in:

https://curl.se/docs/sslcerts.html

With newer versions of google-cloud-cpp you can use CARootsFilePathOption to override the default location of the CA cert file.

  • Related