aws

Nim Sadeh 2023-12-25T03:07:13.892109Z

I am getting the following error trying to run uberjar on a project containing the AWS cognitect library:

Execution error (AssertionError) at cognitect.aws.credentials/basic-credentials-provider (credentials.clj:346).
Assert failed: Missing
access-key-id
I am passing my access key ID via environment variable since I am using Digital Ocean, not AWS:
(def s3 (aws/client {:api :s3
                     :credentials-provider (credentials/basic-credentials-provider
                                            {:access-key-id (:access-key env/digital-ocean)
                                             :secret-access-key (:secret-key env/digital-ocean)})
                     :endpoint-override {:hostname (:hostname env/digital-ocean)
                                         :protocol :https}
                     :region "us-east-2"}))
Where env comes from environ. How can I bypass this?

scottbale 2023-12-26T14:32:13.721359Z

If this works fine in the REPL, then I suspect some difference in the environment when uberjar is being run. If I were you, I'd add some debugging right before (def s3 ... to see what the env/digital-ocean map contains right before the exception occurs, whether or not it contains the expected environment variables.

Ben Sless 2023-12-26T14:40:12.065389Z

Probably uberjar running with different environment than your repl You can check by printing (System/getEnv)

☝️ 2
Nim Sadeh 2023-12-25T03:24:39.046469Z

This code works fine in REPL, btw

Nim Sadeh 2023-12-25T03:30:49.136489Z

Confirmed by using or to pass an empty string to the constructor