Fork me on GitHub
#aws
<
2023-12-15
>
Nimrod Sadeh21:12:12

has anyone used the Cognitect library with Digital Ocean Spaces? The Spaces product conforms to the S3 protocol and I have actually worked with it before in JavaScript using the JavaScript SDK, but some of the bucket/resource resolution stuff is different because it's not literally on AWS and I am having trouble getting the Cognitect library to talk to it

Nimrod Sadeh21:12:04

My setup looks something like this:

(def url "https://.nyc3.digitaloceanspaces.com")

(def s3 (aws/client {:api :s3
                     :credentials-provider (credentials/basic-credentials-provider
                                            {:access-key-id access-key
                                             :secret-access-key secret-key})
                     :endpoint-override {:hostname url}
                     :region "us-east-3"}))
This commands
repl> (aws/invoke s3 {:op :PutObject :request {:Bucket  :Key "hello.txt" :Body "Hello world!"} })
yields
#:cognitect.anomalies{:category :cognitect.anomalies/fault,
                      :message "No known endpoint."}

hiredman21:12:22

It looks like it is saying you may need to supply :region in 2 different places

Nimrod Sadeh21:12:34

I did a Google check but embarrassingly did not find this. Looks like there's a workaround here, I'll try it. Thanks!

Nimrod Sadeh21:12:53

Ah it's not listing the region in two different places, it's explicitly setting the region to east-2

Nimrod Sadeh21:12:38

Definitely would have never figured it out had someone not raised the issue