For authenticating with GCS via a JSON credentials file, the documentation under ?FileSystem for GcsFileSystem$create() says:
{}json_credentials{}: optional string for authentication. Point to a JSON credentials file downloaded from GCS.
Additionally, the GCS Authentication section of Working with Cloud Storage (S3, GCS) in the file system vignette says:
or {}json_credentials{}, to reference a downloaded credentials file.
Both of these seem to imply that json_credentials expects a path to a JSON credentials file downloaded from GCP. However, when a file path is provided you get an invalid argument error:
> bucket <- gs_bucket(bucket = 'pinned_data',json_credentials = json_path)
> bucket$ls(recursive = TRUE)
Error: Invalid: google::cloud::Status(INVALID_ARGUMENT: PermanenterrorinListObjects: InvalidServiceAccountCredentials,parsingfailedondataloadedfrommemory). Detail: [errno22] Invalidargument
However, if you pass a string containing the raw JSON from the file itself, the above code snippet works and returns the names of the objects in the bucket.
Both sections of the documentation should be clarified to explicitly say that the argument expects the actual JSON rather than a file path to the JSON file.
Reporter: Joran Elias
Note: This issue was originally created as ARROW-17894. Please see the migration documentation for further details.
For authenticating with GCS via a JSON credentials file, the documentation under ?FileSystem for GcsFileSystem$create() says:
{}json_credentials{}: optional string for authentication. Point to a JSON credentials file downloaded from GCS.Additionally, the GCS Authentication section of Working with Cloud Storage (S3, GCS) in the file system vignette says:
Both of these seem to imply that json_credentials expects a path to a JSON credentials file downloaded from GCP. However, when a file path is provided you get an invalid argument error:
However, if you pass a string containing the raw JSON from the file itself, the above code snippet works and returns the names of the objects in the bucket.
Both sections of the documentation should be clarified to explicitly say that the argument expects the actual JSON rather than a file path to the JSON file.
Reporter: Joran Elias
Note: This issue was originally created as ARROW-17894. Please see the migration documentation for further details.