cloudyr / aws.s3

Amazon Simple Storage Service (S3) API Client
https://cloud.r-project.org/package=aws.s3
381 stars 147 forks source link

Cannot connect to Backblaze S3 Bucket #404

Closed caewok closed 2 years ago

caewok commented 2 years ago

Running R 4.0.4 with aws.s3 0.3.2.1 and aws.signature 0.6.0.

I cannot connect to a Backblaze S3 bucket. When I try, for example, get_bucket("[bucket_name]", region = ""), I get the following error:

List of 2 $ Code : chr "InvalidRequest" $ Message: chr "header 'x-amz-content-sha256' must be included in signature"

  • attr(, "headers")=List of 7 ..$ x-amz-request-id: chr "a2cd0fd8532d7ca6" ..$ x-amz-id-2 : chr "adX9ufmvXbohvjXf/bmI=" ..$ cache-control : chr "max-age=0, no-cache, no-store" ..$ content-type : chr "application/xml" ..$ content-length : chr "188" ..$ date : chr "Fri, 29 Oct 2021 04:46:20 GMT" ..$ connection : chr "close" ..- attr(, "class")= chr [1:2] "insensitive" "list"
  • attr(*, "class")= chr "aws_error"
  • attr(*, "request_canonical")= chr "GET\n/[bucket_name]/\n\nhost:s3.us-west-002.backblazeb2.com\nx-amz-date:20211029T044621Z\n\nhost;x-amz-date\ne3b"| truncated
  • attr(*, "request_string_to_sign")= chr "AWS4-HMAC-SHA256\n20211029T044621Z\n20211029/us-east-1/s3/aws4_request\n12a378a28207e2ab8c6461f155ad3c072a25586"| truncated
  • attr(*, "request_signature")= chr "AWS4-HMAC-SHA256 Credential=[AWS_ACCESS_KEY_ID]/20211029/us-east-1/s3/aws4_request,SignedHeaders=host;x-a"| truncated NULL Error in parse_aws_s3_response(r, Sig, verbose = verbose) : Bad Request (HTTP 400).

The part where it adds "us-east-1" looks wrong, as that is not the applicable region. (The bracketed items I redacted, FYI.)

I was hoping maybe you had an example of successfully connecting to a Backblaze S3 bucket that I could follow... Tried googling for one with no luck.

Thanks!

caewok commented 2 years ago

Never mind; the problem is that the CRAN version of the package is out of date. (Why?) Loading the package from rForge results in it working:

install.packages("aws.s3", repos = c("https://RForge.net", "https://cloud.R-project.org"))