Search code examples
c++google-cloud-storagegoogle-cloud-cpp

json.exception.parse_error when calling google::cloud::storage::Client


https://github.com/GoogleCloudPlatform/google-cloud-cpp/ https://github.com/GoogleCloudPlatform/google-cloud-cpp/blob/master/google/cloud/storage/examples/storage_quickstart.cc

after building all available libraries, run storage_quickstart

/home/google-cloud-cpp/build-output/google/cloud/storage/examples/storage_quickstart bucket_name project_id

get this

Standard C++ exception raised: [json.exception.parse_error.101] parse error at 1: syntax error - unexpected end of input; expected '[', '{', or a literal

error at

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

Any ideas ?


Solution

  • Looks like your GOOGLE_APPLICATION_DEFAULT_CREDENTIALS is not set, or is pointing to a file in the wrong format. Hopefully the documentation here:

    https://googlecloudplatform.github.io/google-cloud-cpp/latest/storage/index.html

    can help you troubleshoot this. Feel free to open a bug in the GitHub page if you need more help.